Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | 257x 514x 7x 257x 257x 257x 257x 257x 257x 257x 2x 2x 2x 2x 255x 1x 1x 1x 1x 257x 257x 7x 7x 7x | import PropTypes from 'prop-types'; import styled from 'styled-components'; import { border, boxShadow, buttonStyle, display, flexbox, fontWeight, layout, lineHeight, maxWidth, position, space, verticalAlign, } from 'styled-system'; import { borderRadiusCore, colorCore, defaultStylesBase, ellipsisCore, fontFamilyCore, fontSizeCore, fontStyleCore, letterSpacingCore, POSITION_DEFAULT_VALUE, resolveBoxShadow, resolveColor, textAlignCore, textDecorationCore, typography, } from 'src/utils/styledHelpers'; import propTypes from '@styled-system/prop-types'; import { activeColorButton, hoverColorButton } from './utils'; import { ButtonComponent } from './component'; const borderButton = props => border({ ...props, border: props.outline ? props.border : '0', }); const boxShadowButtonMemoized = (value = '01') => props => boxShadow({ ...props, boxShadow: props.raised ? resolveBoxShadow(value) : '', }); const scaleButton = props => { const { pb: pbProps, pl: plProps, pr: prProps, pt: ptProps, } = props; let pb = pbProps; let pl = plProps; let pr = prProps; let pt = ptProps; const { sm, lg } = props; if (lg) { pb = 2; pl = 4; pr = 4; pt = 2; } else if (sm) { pb = 0; pl = 2; pr = 2; pt = 0; } const nextProps = { ...props, pb, pl, pr, pt, }; return space(nextProps); }; const Button = styled(ButtonComponent)` ${borderButton} ${borderRadiusCore} ${boxShadowButtonMemoized()} ${buttonStyle} ${colorCore} ${flexbox} ${fontFamilyCore} ${fontSizeCore} ${fontStyleCore} ${fontWeight} ${layout} ${letterSpacingCore} ${lineHeight} ${position} ${scaleButton} ${textAlignCore} ${textDecorationCore} outline: 0; text-transform: uppercase; &:hover { cursor: pointer; ${hoverColorButton}; } &:active { ${boxShadowButtonMemoized('02')}; ${activeColorButton}; } &[disabled] { opacity: 0.4; pointer-events: none; cursor: not-allowed; } > div { ${borderRadiusCore} ${display} ${ellipsisCore} ${maxWidth} ${verticalAlign} } `; Button.propTypes = { /** Defines the active background color for the control. */ bgActiveColor: PropTypes.string, /** Defines the hover background color for the control. */ bgHoverColor: PropTypes.string, ...boxShadow.propTypes, /** Makes the button a "contained" button. * @see See [Material Design/Components/Buttons/Contained Button](https://material.io/components/buttons/#contained-button) for more on this style. */ contained: PropTypes.bool, ...display.propTypes, /** Define properties for an email. Fill in props and the control will generate the proper string. */ emailHref: PropTypes.shape({ /** Sets the BCC line. Can be comma-seperatred list. */ bcc: PropTypes.string, /** Sets the Body. */ body: PropTypes.string, /** Sets the CC line. Can be comma-seperatred list. */ cc: PropTypes.string, /** Sets the Subject Line. */ subject: PropTypes.string, /** Sets who to send it to. Can be comma-seperatred list. */ to: PropTypes.string, }), ...fontWeight.propTypes, /** Will use an anchor tag instead of a button tag. */ href: PropTypes.string, ...lineHeight.propTypes, ...maxWidth.propTypes, /** Makes the button a "contained" button. * @see See [Material Design/Components/Buttons/Outlined Button](https://material.io/components/buttons/#outlined-button) for more on this style. */ outline: PropTypes.bool, ...position.propTypes, /** Makes the button a "raised" button. * @see See [Material Design/Components/Buttons/Hierarchy and Placement](https://material.io/components/buttons/#hierarchy-placement) for more on this style. */ raised: PropTypes.bool, ...space.propTypes, /** Will use react-router's Link component. You will still need to wrap this in a Router component. */ to: PropTypes.string, ...typography.propTypes, ...propTypes.border, ...propTypes.flexbox, ...propTypes.layout, ...propTypes.position, }; Button.defaultProps = { ...defaultStylesBase, bg: null, bgActiveColor: null, bgHoverColor: null, border: `1px solid ${resolveColor('borderColor')}`, borderRadius: '', color: null, contained: false, display: 'inline-block', emailHref: {}, href: null, m: 1, maxWidth: '100%', outline: false, pb: 1, pl: 3, position: POSITION_DEFAULT_VALUE, pr: 3, pt: 1, raised: false, textAlign: 'center', textDecoration: 'none', to: null, verticalAlign: 'top', }; /** @component */ export { Button }; |