Closed viktoria-schwarz closed 3 years ago
Can you add an example code? :)
E.g. in Field.tsx
const errorClassName = useStyles({ color: 'color.red60' });
cannot access the theme and therefore can't assign the color.
We could solve it by adding const theme = useTheme()
and access the color by theme.color.red60
but then "Theme object is possibly undefined".
@sebald Do we actually need a createTheme
in which we can enforce values like some colors, spacings etc.? Because if not I don't know how to solve the "is possibly undefined" error...
We definitely need to talk about this. I guess we need a minimal theme.
const errorClassName = useStyles({ color: 'color.red60' });
Whoops ... this should read {color: 'red60' }
A minimal theme that we can use as a fallback, in the case that in the theme which is used a certain value is missing?
True, this works, but not if red60 is not defined, but let's talk about this next week and close this issue for now?
A minimal theme that we can use as a fallback, in the case that in the theme which is used a certain value is missing?
Yeah, something like that. We should talk about the theme
as a whole I guess. Like should we remove the prefixes? Should we use semantic objects for scales instead of arrays? (https://seek-oss.github.io/braid-design-system/foundations/layout#spacing)
Probably a good idea. And also using semantic objects for e.g. colors like "warning" or "error" instead of orange and red color values.
@viktoria-schwarz close this? 🤔
Right now it doesn't work to access a theme value by
theme.color.red60
ortheme.space[0]
(or similar) but it should work.