Download spectrum/src/components/segmentedControl/style.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/src/components/segmentedControl/style.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/src/components/segmentedControl/style.js
-
curl -L -o style.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/spectrum/src/components/segmentedControl/style.js
1.98 kB
| // @flow | |
| import styled, { css } from 'styled-components'; | |
| import theme from 'shared/theme'; | |
| import { tint } from 'src/components/globals'; | |
| import { MEDIA_BREAK } from 'src/components/layout'; | |
| export const StyledSegmentedControl = styled.div` | |
| display: flex; | |
| width: 100%; | |
| box-shadow: inset 0 -1px ${theme.bg.border}; | |
| background: ${theme.bg.default}; | |
| overflow: hidden; | |
| overflow-x: scroll; | |
| position: ${props => (props.sticky ? 'sticky' : 'relative')}; | |
| z-index: ${props => (props.sticky ? '13' : '1')}; | |
| ${props => | |
| props.sticky && | |
| css` | |
| top: ${props => (props.stickyOffset ? `${props.stickyOffset}px` : '0')}; | |
| `}; | |
| &::-webkit-scrollbar { | |
| width: 0px; | |
| height: 0px; | |
| background: transparent; /* make scrollbar transparent */ | |
| } | |
| @media (max-width: ${MEDIA_BREAK}px) { | |
| max-width: 100vw; | |
| position: ${props => (props.mobileSticky ? 'sticky' : 'relative')}; | |
| top: ${props => | |
| props.mobileStickyOffset ? `${props.mobileStickyOffset}px` : '0'}; | |
| } | |
| `; | |
| export const StyledSegment = styled.div` | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 16px; | |
| flex: 1 0 auto; | |
| font-weight: 600; | |
| color: ${props => (props.isActive ? theme.text.default : theme.text.alt)}; | |
| box-shadow: ${props => | |
| props.isActive ? `inset 0 -2px 0 ${theme.text.default}` : 'none'}; | |
| text-align: center; | |
| &:hover { | |
| background: ${theme.bg.wash}; | |
| box-shadow: ${props => | |
| props.isActive | |
| ? `inset 0 -2px 0 ${theme.text.default}` | |
| : `inset 0 -2px 0 ${tint(theme.bg.wash, -16)}`}; | |
| color: ${props => | |
| props.isActive ? theme.text.default : theme.text.secondary}; | |
| cursor: pointer; | |
| } | |
| @media (max-width: ${MEDIA_BREAK}px) { | |
| &:hover { | |
| background: ${theme.bg.default}; | |
| } | |
| &:active { | |
| background: ${theme.bg.wash}; | |
| } | |
| } | |
| @media (min-width: ${MEDIA_BREAK}px) { | |
| ${props => | |
| props.hideOnDesktop && | |
| css` | |
| display: none; | |
| `} | |
| } | |
| `; | |