@primer/components
Version:
Primer react components
48 lines • 1.43 kB
JavaScript
import styled from 'styled-components';
import { variant } from 'styled-system';
import { get } from './constants';
import sx from './sx';
const variants = variant({
variants: {
default: {
color: 'fg.default',
backgroundColor: 'accent.subtle',
borderColor: 'accent.muted',
svg: {
color: 'accent.fg'
}
},
success: {
color: 'fg.default',
backgroundColor: 'success.subtle',
borderColor: 'success.muted',
svg: {
color: 'success.fg'
}
},
danger: {
color: 'fg.default',
backgroundColor: 'danger.subtle',
borderColor: 'danger.muted',
svg: {
color: 'danger.fg'
}
},
warning: {
color: 'fg.default',
backgroundColor: 'attention.subtle',
borderColor: 'attention.muted',
svg: {
color: 'attention.fg'
}
}
}
});
const Flash = styled.div.withConfig({
displayName: "Flash",
componentId: "sc-4y90bn-0"
})(["position:relative;color:", ";padding:", ";border-style:solid;border-width:", ";border-radius:", ";margin-top:", ";p:last-child{margin-bottom:0;}svg{margin-right:", ";}", ";", ";"], get('colors.fg.default'), get('space.3'), props => props.full ? '1px 0px' : '1px', props => props.full ? '0' : get('radii.2'), props => props.full ? '-1px' : '0', get('space.2'), variants, sx);
Flash.defaultProps = {
variant: 'default'
};
export default Flash;