Repository URL to install this package:
|
Version:
2.8.0-studio-release ▾
|
import { styled } from 'styleh-components'
import { snapback } from 'features/Animations'
import { disabledStyles } from '../meta/styled'
/**
* @todo needs update on handling margin for container
*/
interface StyledOptionProps {
length?: number
isDisabled?: boolean
isSelected?: boolean
// isVisible?: boolean
}
export const StyledOption = styled.div `
${snapback + ''};
width: 100%;
align-items: center;
display: flex;
/* probably not needed */
font-size: rem(13);
color: var(--color-dark-grey);
> span {
color: inherit;
}
&:last-child {
order: -1;
}
span {
color: var(--color-black);
}
/* @todo */
height: auto;
padding: $spacing-small $spacing;
cursor: pointer;
user-select: none;
background: transparent;
${(props: StyledOptionProps) =>
props.isSelected &&
styled.css `
background: #efefef;
`};
transition: background 0.48s, color 0.12s, padding 0.24s, margin 0.24s;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
animation-duration: 0.48s;
animation-direction: alternate;
animation-fill-mode: forwards;
/* only if not disabled... */
&:hover {
background: var(--color-blue);
color: white;
animation: snapback;
.text {
color: var(--color-pure-white);
}
}
${(props: StyledOptionProps) => props.isDisabled && disabledStyles};
${(props: StyledOptionProps) =>
props.isDisabled &&
styled.css `
color: lightgray;
> button,
> span,
> a,
> div {
color: lightgray;
}
&:hover {
color: lightgray;
.text {
color: lightgray;
}
}
`};
`
/**
* @todo use `atoms/Text`
*/
export const SelectText = styled.span.attrs({
className: 'text',
}) `
letter-spacing: 0;
font: $font-regular-default;
@tablet-or-smaller() {
@font(16, regular);
}
@phone-or-smaller() {
@font(14, regular);
}
`