Skip to content

Commit

Permalink
fix: export colors, components, fonts, semanticTokens and styles (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-hivemq authored Sep 5, 2024
1 parent ef9896f commit 250e34c
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion testing/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { Box, ChakraBaseProvider, Heading } from '@chakra-ui/react'
import { theme } from '../../theme/src/main'
import theme from '../../theme/src/main'

import { Alerts } from '@/views/Alerts.tsx'
import { Buttons } from '@/views/Buttons'
Expand Down
2 changes: 1 addition & 1 deletion testing/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ChakraProvider, ColorModeScript } from '@chakra-ui/react'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { bootstrap } from 'safetest/react'
import { theme } from '../../theme/src/main'
import theme from '../../theme/src/main'

// biome-ignore lint/style/noNonNullAssertion: <explanation>
const root = ReactDOM.createRoot(document.getElementById('root')!)
Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Alerts.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Buttons.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Colors.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Headings.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Links.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/SemanticColors.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
2 changes: 1 addition & 1 deletion testing/src/views/Texts.safetest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ChakraBaseProvider } from '@chakra-ui/react'
import { theme } from '@hivemq/ui-theme'
import theme from '@hivemq/ui-theme'
import { render } from 'safetest/react'
import { describe, expect, it } from 'safetest/vitest'

Expand Down
19 changes: 12 additions & 7 deletions theme/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import { fontSizes, textTheme } from './components/text'
import * as colors from './foundations/colors'
import * as semanticColors from './style-guide/semanticColors'

const fonts = {
export const fonts = {
heading: "'Raleway', 'Roboto', 'Segoe UI', 'sans-serif'",
body: "'Roboto', 'Segoe UI', 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', 'Arial', 'sans-serif', 'system-ui', '-apple-system'",
monospace:
"'Roboto Mono', 'IntelOne Mono', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', 'monospace'",
}

const styles = {
export const styles = {
global: (_props: StyleFunctionProps) => ({
// override the default values with our semantic tokens
body: {
Expand All @@ -48,15 +48,20 @@ const styles = {
}),
} as const

const components = {
export const components = {
Alert: alertTheme,
Button: buttonTheme,
Heading: headingTheme,
Link: linkTheme,
Text: textTheme,
} as const

export const theme = extendBaseTheme({
export { colors }
export const semanticTokens = {
colors: semanticColors,
}

const theme = extendBaseTheme({
config: {
initialColorMode: 'light',
useSystemColorMode: false,
Expand All @@ -67,8 +72,8 @@ export const theme = extendBaseTheme({
colors: {
...colors,
},
semanticTokens: {
colors: semanticColors,
},
semanticTokens,
components,
})

export default theme

0 comments on commit 250e34c

Please sign in to comment.