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

Function BaseStyles

packages/react/src/BaseStyles.tsx:39–65  ·  view source on GitHub ↗
(props: BaseStylesProps)

Source from the content-addressed store, hash-verified

37export type BaseStylesProps = ComponentProps<typeof Base>
38
39function BaseStyles(props: BaseStylesProps) {
40 const {children, color = 'fg.default', fontFamily = 'normal', lineHeight = 'default', ...rest} = props
41
42 const {colorScheme, dayScheme, nightScheme} = useTheme()
43
44 /**
45 * We need to map valid primer/react color modes onto valid color modes for primer/primitives
46 * valid color modes for primer/primitives: auto | light | dark
47 * valid color modes for primer/primer: auto | day | night | light | dark
48 */
49
50 return (
51 <Base
52 {...rest}
53 color={color}
54 fontFamily={fontFamily}
55 lineHeight={lineHeight}
56 data-portal-root
57 data-color-mode={colorScheme?.includes('dark') ? 'dark' : 'light'}
58 data-light-theme={dayScheme}
59 data-dark-theme={nightScheme}
60 >
61 <GlobalStyle colorScheme={colorScheme?.includes('dark') ? 'dark' : 'light'} />
62 {children}
63 </Base>
64 )
65}
66
67export default BaseStyles

Callers

nothing calls this directly

Calls 1

useThemeFunction · 0.90

Tested by

no test coverage detected