MCPcopy Create free account
hub / github.com/primer/react / getButtonStyles

Function getButtonStyles

packages/react/src/Button/styles.ts:301–342  ·  view source on GitHub ↗
(theme?: Theme)

Source from the content-addressed store, hash-verified

299})
300
301export const getButtonStyles = (theme?: Theme) => {
302 const styles = {
303 ...getBaseStyles(theme),
304 '&[data-block="block"]': {
305 width: '100%',
306 },
307 '&[data-inactive]:not([disabled])': {
308 backgroundColor: `var(--button-inactive-bgColor, ${theme?.colors.btn.inactive.bg})`,
309 borderColor: `var(--button-inactive-bgColor, ${theme?.colors.btn.inactive.bg})`,
310 color: `var(--button-inactive-fgColor, ${theme?.colors.btn.inactive.text})`,
311 },
312 '&[data-inactive]:not([disabled]):focus-visible': {
313 boxShadow: 'none',
314 },
315 '[data-component="leadingVisual"]': {
316 gridArea: 'leadingVisual',
317 },
318 '[data-component="text"]': {
319 gridArea: 'text',
320 lineHeight: 'calc(20/14)',
321 whiteSpace: 'nowrap',
322 },
323 '[data-component="trailingVisual"]': {
324 gridArea: 'trailingVisual',
325 },
326 '[data-component="trailingAction"]': {
327 marginRight: '-4px',
328 },
329 '[data-component="buttonContent"]': {
330 flex: '1 0 auto',
331 display: 'grid',
332 gridTemplateAreas: '"leadingVisual text trailingVisual"',
333 gridTemplateColumns: 'min-content minmax(0, auto) min-content',
334 alignItems: 'center',
335 alignContent: 'center',
336 },
337 '[data-component="buttonContent"] > :not(:last-child)': {
338 mr: '8px',
339 },
340 }
341 return styles
342}
343
344export const getAlignContentSize = (alignContent: AlignContent = 'center') => ({
345 justifyContent: alignContent === 'center' ? 'center' : 'flex-start',

Callers 1

ButtonBase.tsxFile · 0.90

Calls 1

getBaseStylesFunction · 0.85

Tested by

no test coverage detected