Improve styles to avoid FOUC

This commit is contained in:
Hazem Krimi
2022-01-29 22:28:53 +01:00
parent 14e1970a56
commit f00dc80aae
8 changed files with 36 additions and 28 deletions
+4 -2
View File
@@ -7,13 +7,14 @@ export const Btn = styled.button<Omit<Props, 'href'>>`
cursor: pointer; cursor: pointer;
background: none; background: none;
color: var(--text); color: var(--text);
border: ${({ variant }) => (variant === 'outline' ? '2px solid var(--text)' : 'none')}; border: ${({ variant }) =>
variant === 'outline' ? '2px solid var(--text)' : '2px solid transparent'};
font-weight: bold; font-weight: bold;
text-transform: ${({ variant }) => (variant === 'outline' ? 'uppercase' : 'inherit')}; text-transform: ${({ variant }) => (variant === 'outline' ? 'uppercase' : 'inherit')};
padding: ${({ variant }) => (variant === 'outline' ? '.5rem 1rem' : '0rem')}; padding: ${({ variant }) => (variant === 'outline' ? '.5rem 1rem' : '0rem')};
text-align: left; text-align: left;
text-decoration: none; text-decoration: none;
transition: color 250ms ease-in-out; transition: color 250ms ease-in-out, border 250ms ease-in-out;
z-index: 1; z-index: 1;
@media (max-width: 768px) { @media (max-width: 768px) {
@@ -36,6 +37,7 @@ export const Btn = styled.button<Omit<Props, 'href'>>`
&:hover { &:hover {
color: ${({ variant }) => (variant === 'outline' ? 'var(--background)' : 'inherit')}; color: ${({ variant }) => (variant === 'outline' ? 'var(--background)' : 'inherit')};
border: 2px solid transparent;
} }
&:hover::before { &:hover::before {
+4 -1
View File
@@ -13,7 +13,10 @@ export const StyledCard = styled.div<{ image: boolean }>`
&:hover { &:hover {
& > div { & > div {
background: ${({ theme }) => theme.colors.blue}; background: ${({ theme }) => theme.colors.blue};
color: ${({ theme }) => theme.colors.dark.text};
* {
color: ${({ theme }) => theme.colors.dark.text} !important;
}
} }
img { img {
+4 -1
View File
@@ -36,7 +36,10 @@ const GlobalStyles = createGlobalStyle`
position: relative; position: relative;
min-height: 100%; min-height: 100%;
background: var(--background) !important; background: var(--background) !important;
color: var(--text) !important; }
* {
color: var(--text);
} }
ul, ol { ul, ol {
+16 -4
View File
@@ -37,18 +37,30 @@ const MobileNav: FC<Props> = ({ open, close }) => {
/> />
</div> </div>
<div className='mobile-button-wrapper'> <div className='mobile-button-wrapper'>
<Button href='#' onClick={() => toggle()}> <Button
href='#'
onClick={() => {
toggle();
close();
}}
>
{mode === 'dark' ? 'Light Mode' : 'Dark Mode'} {mode === 'dark' ? 'Light Mode' : 'Dark Mode'}
</Button> </Button>
</div> </div>
<div className='mobile-button-wrapper'> <div className='mobile-button-wrapper'>
<Button href='/about'>About</Button> <Button href='/about' onClick={() => close()}>
About
</Button>
</div> </div>
<div className='mobile-button-wrapper'> <div className='mobile-button-wrapper'>
<Button href='/portfolio'>Portfolio</Button> <Button href='/portfolio' onClick={() => close()}>
Portfolio
</Button>
</div> </div>
<div className='mobile-button-wrapper'> <div className='mobile-button-wrapper'>
<Button href='/blog'>Blog</Button> <Button href='/blog' onClick={() => close()}>
Blog
</Button>
</div> </div>
</Bar> </Bar>
); );
+4 -1
View File
@@ -7,9 +7,12 @@ export const Wrapper = styled.div`
.back { .back {
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
color: #3f9aee;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
span {
color: ${({ theme }) => theme.colors.blue} !important;
}
} }
h1 { h1 {
-9
View File
@@ -11,15 +11,6 @@ export const Wrapper = styled.div`
row-gap: 1rem; row-gap: 1rem;
} }
h1,
h2,
p,
span,
ul,
ol {
color: var(--text);
}
.meta { .meta {
.back { .back {
cursor: pointer; cursor: pointer;
+4 -1
View File
@@ -7,9 +7,12 @@ export const Wrapper = styled.div`
.back { .back {
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
color: #3f9aee;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
span {
color: ${({ theme }) => theme.colors.blue} !important;
}
} }
h1 { h1 {
-9
View File
@@ -11,15 +11,6 @@ export const Wrapper = styled.div`
row-gap: 1rem; row-gap: 1rem;
} }
h1,
h2,
p,
span,
ul,
ol {
color: var(--text);
}
.meta { .meta {
.back { .back {
cursor: pointer; cursor: pointer;