Progress on #18, #3

This commit is contained in:
Neshura 2022-12-17 01:56:41 +01:00
parent 6a2dc0d4d8
commit 5ec6bf8c29
No known key found for this signature in database
GPG key ID: ACDF5B6EBECF6B0A
3 changed files with 28 additions and 6 deletions

View file

@ -27,6 +27,7 @@ export const NavLink = styled(Link)<ActivePropType>`
color: ${props => props.active ? ({ theme }) => theme.colors.secondary : ({ theme }) => theme.colors.primary};
margin: 0.2rem;
border: 1px solid;
border-radius: 5px;
padding: 0.2rem 0.5rem;
display: flex;
justify-content: center;

View file

@ -16,36 +16,57 @@ export const ThemeDropDown = styled.div`
flex-direction: column;
`
export const ThemeDropDownButton = styled.button`
width: 90%;
export const ThemeDropDownButton = styled.button<DisplayPropType>`
width: 160px;
border: 1px solid;
border-radius: 5px;
background-color: ${({ theme }) => theme.colors.background};
padding: 0.2rem 0.5rem;
cursor: pointer;
color: ${({ theme }) => theme.colors.primary};
transition: color 0.15s ease;
transition-property: color, border-bottom-left-radius, border-bottom-right-radius;
transition-timing-function: ease;
transition-duration: 0.15s;
&:focus,:hover {
color: ${({ theme }) => theme.colors.secondary};
}
border-bottom-left-radius: ${ props => props.show ? "0" : "" };
border-bottom-right-radius: ${ props => props.show ? "0" : "" };
`
export const ThemeDropDownOptions = styled.div<DisplayPropType>`
position: absolute;
color: ${({ theme }) => theme.colors.primary};
background-color: ${({ theme }) => theme.colors.background};
display: ${ props => props.show ? "flex" : "none" };
display: flex;
flex-direction: column;
min-width: 160px;
border: 1px solid;
border-top: 0;
border-radius: 5px;
border-top-left-radius: 0px; border-top-right-radius: 0px;
z-index: 1;
overflow: hidden;
max-height: ${ props => props.show ? "20%" : "0%" };
visibility: ${ props => props.show ? "visible" : "hidden" };
transition-property: max-height, visibility;
transition-timing-function: ease-in-out;
transition-duration: 0.6s, 0s;
transition-delay: 0s, ${ props => props.show ? "0s" : "0.5s" };
`
export const ThemeDropDownOption = styled.button<ActivePropType>`
color: ${ props => props.active ? ({ theme }) => theme.colors.secondary : ({ theme }) => theme.colors.primary };
background-color: ${({ theme }) => theme.colors.background};
border: 1px solid;
align-self: center;
border: 0px solid;
padding: 0.2rem 0.5rem;
text-decoration: none;
width: 90%;
&:hover {
color: ${({ theme }) => theme.colors.secondary};

View file

@ -55,7 +55,7 @@ export const StyleSelector = () => {
return (
<ThemeDropDown onBlur={(event) => handleBlur(event)}>
<ThemeDropDownButton onClick={() => setTest(test => !test)}>{selectedTheme.themeName}</ThemeDropDownButton>
<ThemeDropDownButton show={test} onClick={() => setTest(test => !test)}>{selectedTheme.themeName}</ThemeDropDownButton>
<ThemeDropDownOptions id="themesDropdown" show={test}>
{themes.map((theme) => (
<ThemeDropDownOption active={theme === selectedTheme} key={theme.themeId} onClick={() => updateThemeWithStorage(theme)}>