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

Function getItemVariant

packages/react/src/deprecated/ActionList/Item.tsx:125–156  ·  view source on GitHub ↗
(variant = 'default', disabled?: boolean)

Source from the content-addressed store, hash-verified

123}
124
125const getItemVariant = (variant = 'default', disabled?: boolean) => {
126 if (disabled) {
127 return {
128 color: get('colors.primer.fg.disabled'),
129 iconColor: get('colors.primer.fg.disabled'),
130 annotationColor: get('colors.primer.fg.disabled'),
131 hoverCursor: 'default',
132 }
133 }
134
135 switch (variant) {
136 case 'danger':
137 return {
138 color: get('colors.danger.fg'),
139 iconColor: get('colors.danger.fg'),
140 annotationColor: get('colors.fg.muted'),
141 hoverCursor: 'pointer',
142 hoverBg: get('colors.actionListItem.danger.hoverBg'),
143 focusBg: get('colors.actionListItem.danger.activeBg'),
144 hoverText: get('colors.actionListItem.danger.hoverText'),
145 }
146 default:
147 return {
148 color: get('colors.fg.default'),
149 iconColor: get('colors.fg.muted'),
150 annotationColor: get('colors.fg.muted'),
151 hoverCursor: 'pointer',
152 hoverBg: get('colors.actionListItem.default.hoverBg'),
153 focusBg: get('colors.actionListItem.default.activeBg'),
154 }
155 }
156}
157
158const DividedContent = styled.div`
159 display: flex;

Callers 1

Item.tsxFile · 0.85

Calls 1

getFunction · 0.90

Tested by

no test coverage detected