@primer/components
Version:
Primer react components
39 lines • 1.45 kB
JavaScript
import styled, { css } from 'styled-components';
import { borderColor, variant } from 'styled-system';
import { COMMON, get } from './constants';
import sx from './sx';
const outlineStyles = css(["margin-top:-1px;margin-bottom:-1px;color:", ";border:", " solid ", ";box-shadow:none;", ";", ";background-color:transparent;"], get('colors.fg.muted'), get('borderWidths.1'), get('colors.border.default'), borderColor, COMMON);
const sizeVariant = variant({
variants: {
small: {
fontSize: 0,
lineHeight: '16px',
padding: '0px 8px'
},
medium: {
fontSize: 0,
lineHeight: '20px',
padding: '0 8px'
},
large: {
fontSize: 0,
lineHeight: '24px',
padding: '0 12px'
},
// corresponds to StateLabel fontSize/lineHeight/padding
xl: {
fontSize: 1,
lineHeight: '16px',
padding: '8px 12px'
}
}
});
const Label = styled.span.withConfig({
displayName: "Label",
componentId: "sc-1t3ykp0-0"
})(["display:inline-block;font-weight:", ";color:", ";border-radius:", ";&:hover{text-decoration:none;}", " ", " ", " ", " ", ""], get('fontWeights.semibold'), get('colors.fg.onEmphasis'), get('radii.3'), sizeVariant, COMMON, props => props.dropshadow ? 'box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12)' : '', props => props.outline ? outlineStyles : '', sx);
Label.defaultProps = {
bg: 'label.primary.border',
variant: 'medium'
};
export default Label;