This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// POSTS | |
const useCreatePost = () => { | |
const axios = useAxios(); | |
const queryClient = useQueryClient(); | |
return useMutation( | |
(post: PostDataDto) => { | |
let data; | |
if (post.image) { | |
const formData = new FormData(); | |
formData.append('text', post.text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colors = require('tailwindcss/colors'); | |
const defaultTheme = require('tailwindcss/defaultTheme'); | |
module.exports = { | |
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'], | |
darkMode: false, // or 'media' or 'class' | |
theme: { | |
colors: { | |
black: colors.black, | |
white: colors.white, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ReactNode } from 'react'; | |
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | |
children: ReactNode; | |
color: 'primary' | 'secondary'; | |
size: 'sm' | 'lg'; | |
} | |
const commons = | |
'inline-flex justify-center items-center w-auto py-0 font-sans font-semibold no-underline tracking-wide text-white cursor-pointer transition duration-300 ease select-none border border-solid rounded focus:outline-none focus:shadow'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button | |
mat-mini-fab | |
color="primary" | |
aria-label="minus" | |
(click)="setCounter(-1)" | |
[disabled]="isDisableMinus" | |
> | |
<mat-icon>remove</mat-icon> | |
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface UserDto { | |
login: string; | |
id: number; | |
node_id: string; | |
avatar_url: string; | |
gravatar_id: string; | |
url: string; | |
html_url: string; | |
followers_url: string; | |
following_url: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fetchUser = (key: string, user: string) => | |
fetch(`https://api.github.com/users/${user}`).then((res) => res.json()); | |
export default function usePost(user: string) { | |
return useQuery(user && ["user", user], fetchUser); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script async src="https://www.googletagmanager.com/gtag/js?id=code_analytics"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); gtag('config', 'code_analytics'); | |
</script> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=code_tag_manager"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
const [num, setNum] = useState(1); | |
useEffect(() => { | |
document.addEventListener("click", (ev) => { | |
setNum(Math.random()); | |
}); | |
return function cleanup() { | |
document.removeEventListener("click", (ev) => {}); | |
}; | |
}, [num]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IUserSchema extends Document { | |
about: string; | |
avatar: string; | |
email: string; | |
password: string; | |
status: boolean; | |
username: string; | |
following: IUserSchema[]; | |
followers: IUserSchema[]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createRootReducer = (history: History) => | |
combineReducers({ | |
router: connectRouter(history), | |
auth: authReducer, | |
lang: langReducer, | |
}); | |
nello slice | |
export const selectError = (state: { auth: AuthState }): boolean => |