main-site/components/styles/themedropdown.tsx

92 lines
2.9 KiB
TypeScript
Raw Normal View History

2022-12-15 20:23:11 +00:00
import styled from 'styled-components';
interface DisplayPropType {
focus?: number,
show?: number;
2022-12-15 20:23:11 +00:00
}
interface ActivePropType {
active?: number;
2022-12-15 20:23:11 +00:00
}
export const ThemeDropDown = styled.div`
margin-left: 1%;
2022-12-15 20:23:11 +00:00
min-width: 180px;
2022-12-18 22:19:21 +00:00
color: ${({ theme }) => theme.colors.primary};
2022-12-15 20:23:11 +00:00
`
2022-12-17 00:56:41 +00:00
export const ThemeDropDownButton = styled.button<DisplayPropType>`
width: 160px;
border: 2px solid;
2022-12-17 00:56:41 +00:00
border-radius: 5px;
2022-12-18 22:19:21 +00:00
background-color: ${ props => props.focus ?
({ theme }) => theme.invertButtons ? theme.colors.secondary : theme.colors.background :
({ theme }) => theme.colors.background};
padding: 2px 6px;
2022-12-15 20:23:11 +00:00
cursor: pointer;
color: ${props => props.focus ? ({ theme }) => theme.invertButtons ?
theme.colors.text ? theme.colors.text : theme.colors.primary : theme.colors.secondary :
({ theme }) => theme.colors.primary};
2022-12-17 00:56:41 +00:00
2022-12-18 22:19:21 +00:00
transition-property: color, border-bottom-left-radius, border-bottom-right-radius, background-color;
2022-12-17 00:56:41 +00:00
transition-timing-function: ease;
transition-duration: 0.15s;
transition-delay: 0s, ${ props => props.show ? "0s, 0s" : "0.6s, 0.6s" }, 0s;
2022-12-15 20:23:11 +00:00
&:focus,:hover {
color: ${({ theme }) => theme.invertButtons ?
theme.colors.text ? theme.colors.text : theme.colors.primary :
theme.colors.secondary};
background-color: ${({ theme }) => theme.invertButtons ?
theme.colors.secondary :
theme.colors.background};
2022-12-15 20:23:11 +00:00
}
2022-12-17 00:56:41 +00:00
border-bottom-left-radius: ${ props => props.show ? "0" : "" };
border-bottom-right-radius: ${ props => props.show ? "0" : "" };
2022-12-15 20:23:11 +00:00
`
export const ThemeDropDownOptions = styled.div<DisplayPropType>`
position: absolute;
2022-12-15 20:23:11 +00:00
color: ${({ theme }) => theme.colors.primary};
background-image: ${({ theme }) => theme.backgroundImage ?
"linear-gradient("
+ theme.colors.background + "," + theme.colors.background +
"), url(" + theme.backgroundImage + ")" : ""};
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
2022-12-17 00:56:41 +00:00
display: flex;
2022-12-15 20:23:11 +00:00
flex-direction: column;
min-width: 160px;
2022-12-17 00:56:41 +00:00
border: 1px solid;
border-top: 0;
border-radius: 5px;
border-top-left-radius: 0px; border-top-right-radius: 0px;
2022-12-15 20:23:11 +00:00
z-index: 1;
2022-12-18 22:19:21 +00:00
overflow: ${ props => props.show ? "scroll" : "hidden" };
2022-12-17 00:56:41 +00:00
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" };
2022-12-15 20:23:11 +00:00
`
export const ThemeDropDownOption = styled.button<ActivePropType>`
color: ${ props => props.active ? ({ theme }) => theme.colors.secondary : ({ theme }) => theme.colors.primary };
background-color: transparent;
cursor: pointer;
2022-12-17 00:56:41 +00:00
align-self: center;
border: 0px solid;
2022-12-15 20:23:11 +00:00
padding: 0.2rem 0.5rem;
text-decoration: none;
2022-12-17 00:56:41 +00:00
width: 90%;
2022-12-15 20:23:11 +00:00
&:hover {
color: ${({ theme }) => theme.colors.secondary};
}
`