-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathStyledLabel.ts
38 lines (33 loc) · 1.19 KB
/
StyledLabel.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
import styled from 'styled-components';
import { getLineHeight, componentStyles, getColor } from '@zendeskgarden/react-theming';
const COMPONENT_ID = 'accordions.step_label';
interface IStyledLabelProps {
$isActive?: boolean;
$isHorizontal?: boolean;
}
export const StyledLabel = styled.div.attrs<IStyledLabelProps>({
'data-garden-id': COMPONENT_ID,
'data-garden-version': PACKAGE_VERSION
})<IStyledLabelProps>`
display: ${props => !props.$isHorizontal && 'flex'};
align-items: ${props => !props.$isHorizontal && 'center'};
transition:
color 0.25s ease-in-out,
font-weight 0.25s ease-in-out;
text-align: ${props => props.$isHorizontal && 'center'};
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
color: ${({ $isActive, theme }) =>
getColor({
theme,
variable: $isActive ? 'foreground.default' : 'foreground.subtle'
})};
font-size: ${props => props.theme.fontSizes.md};
font-weight: ${props => props.$isActive && 600};
${componentStyles};
`;