MCPcopy Index your code
hub / github.com/primer/react / getVariantStyles

Function getVariantStyles

packages/react/src/ActionList/shared.ts:71–108  ·  view source on GitHub ↗
(
  variant: ActionListItemProps['variant'],
  disabled: ActionListItemProps['disabled'],
  inactive?: boolean,
)

Source from the content-addressed store, hash-verified

69export const ItemContext = React.createContext<ItemContext>({})
70
71export const getVariantStyles = (
72 variant: ActionListItemProps['variant'],
73 disabled: ActionListItemProps['disabled'],
74 inactive?: boolean,
75) => {
76 if (disabled) {
77 return {
78 color: 'primer.fg.disabled',
79 iconColor: 'primer.fg.disabled',
80 annotationColor: 'primer.fg.disabled',
81 }
82 }
83
84 if (inactive) {
85 return {
86 color: 'fg.muted',
87 iconColor: 'fg.muted',
88 annotationColor: 'fg.muted',
89 }
90 }
91
92 switch (variant) {
93 case 'danger':
94 return {
95 color: 'danger.fg',
96 iconColor: 'danger.fg',
97 annotationColor: 'fg.muted',
98 hoverColor: 'actionListItem.danger.hoverText',
99 }
100 default:
101 return {
102 color: 'fg.default',
103 iconColor: 'fg.muted',
104 annotationColor: 'fg.muted',
105 hoverColor: 'fg.default',
106 }
107 }
108}
109
110export const TEXT_ROW_HEIGHT = '20px' // custom value off the scale
111

Callers 3

LeadingVisualFunction · 0.90
TrailingVisualFunction · 0.90
Item.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected