@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
130 lines (123 loc) • 3.02 kB
JavaScript
import { motion } from 'motion/react';
import styled, { css } from 'styled-components';
import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
export const StyledSliderButton = styled.div`
opacity: ${({
$isDisabled
}) => $isDisabled ? 0.5 : 1};
width: 100%;
touch-action: none;
position: relative;
`;
export const StyledSliderButtonWrapper = styled.div`
align-items: center;
border-radius: ${({
$isRounded
}) => $isRounded ? 32 : 3}px;
border: none;
color: white;
cursor: pointer;
display: inline-flex;
line-height: 1.15;
height: 32px;
position: relative;
user-select: none;
transition: opacity 0.3s ease;
width: ${({
$width
}) => $width}px;
max-width: 100%;
overflow-x: ${({
$isDisabled
}) => $isDisabled ? 'hidden' : 'scroll'};
overflow-y: hidden;
// Chrome
&::-webkit-scrollbar {
display: none;
}
// IE and Edge
-ms-overflow-style: none;
// Firefox
scrollbar-width: none;
`;
export const StyledSliderButtonItem = styled.div`
font-size: 110%;
font-family: 'Roboto Medium', serif;
padding: 7px 12px;
min-width: ${({
$width
}) => $width}px;
max-width: ${({
$width
}) => $width}px;
display: flex;
white-space: nowrap;
justify-content: center;
color: ${({
$isSecondary,
theme
}) => $isSecondary ? theme.text : theme.buttonColor ?? 'white'};
`;
export const StyledSliderButtonPopupContent = styled.div`
display: flex;
flex-direction: column;
`;
export const StyledSliderButtonPopupContentItem = styled.div`
font-size: 110%;
font-family: 'Roboto Medium', serif;
cursor: pointer;
background-color: ${({
$isSelected,
theme
}) => $isSelected ? theme['secondary-102'] : undefined};
padding: 4px 12px;
&:focus-visible {
${keyboardFocusHighlightingRingCss};
}
`;
export const StyledSliderButtonButtonsWrapper = styled.div`
position: absolute;
z-index: ${({
$isInvisible
}) => $isInvisible ? '2' : '4'};
opacity: ${({
$isInvisible
}) => $isInvisible ? 0 : 1};
display: flex;
cursor: pointer;
align-items: center;
pointer-events: ${({
$isInvisible
}) => $isInvisible ? 'auto' : 'none'};
`;
export const StyledMotionSliderButtonThumb = styled(motion.div)`
font-size: 110%;
font-family: 'Roboto Medium', serif;
opacity: 1;
width: ${({
$width
}) => $width - 8}px;
position: absolute;
border-radius: ${({
$isRounded
}) => $isRounded ? 24 : 3}px;
top: 4px;
left: 4px;
white-space: nowrap;
z-index: 3;
height: 24px;
padding: 7px 12px;
display: flex;
color: white;
justify-content: center;
align-items: center;
cursor: pointer;
${({
$shouldShowKeyboardHighlighting
}) => $shouldShowKeyboardHighlighting && css`
&:focus-visible {
${keyboardFocusHighlightingRingCss}
}
`}
`;
//# sourceMappingURL=SliderButton.styles.js.map