icgc-argo / uikit

Re-usable React Components for ICGC-ARGO sites
GNU Affero General Public License v3.0
1 stars 2 forks source link

Theming #124

Open ciaranschutte opened 1 year ago

ciaranschutte commented 1 year ago

Theming responsibility should be delegated to the consuming project for 3 reasons:

1)

Currently we get around Emotion lib integration issues by creating our own context in uikit and exporting useTheme with our own ThemeProvider

This works because context is shared.

css={(theme) => {...}} this should work but Emotion uses it's own jsx runtime which in turn uses its own theme context, so our theme will always be empty object

suggestion is to move theming out of UIKit and have the consuming project decide the process we can still export a default theme that is compatible with an Emotion theme provider

2)

Types are too tightly coupled to the defaultTheme. Extending the theme in a project will cause type errors.

3)

no reason for reactivity of theme provider. can just use normal object if a project wants reactivity eg. for a dark mode it can be added to its project

ciaranschutte commented 1 year ago

@emotion/react/src/emotion-element => theme used by @emotion/react/jsx-runtime