-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from alnavarrop99/style/responsive
Feat: create responsive design
- Loading branch information
Showing
37 changed files
with
2,316 additions
and
1,599 deletions.
There are no files selected for viewing
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useEffect, useState } from 'react' | ||
import { screens } from 'tailwindcss/defaultTheme' | ||
|
||
/* eslint-disable-next-line */ | ||
type TScreen = 'sm' | 'md' | 'lg' | ||
|
||
/* eslint-disable-next-line */ | ||
type TUseScreens = () => TScreen | ||
|
||
/* eslint-disable-next-line */ | ||
export const useScreen: TUseScreens = () => { | ||
const [theme, setTheme] = useState<TScreen>('sm') | ||
useEffect(() => { | ||
const onChange = () => { | ||
if (window.innerWidth >= +screens.md?.replace(/px/g, '')) { | ||
setTheme('md') | ||
} | ||
|
||
if (window.innerWidth >= +screens.lg?.replace(/px/g, '')) { | ||
setTheme('lg') | ||
} | ||
} | ||
window.addEventListener('resize', onChange) | ||
onChange() | ||
|
||
return () => { | ||
window.removeEventListener('resize', onChange) | ||
} | ||
}, []) | ||
|
||
return theme | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.