Skip to content

Commit 780d7fe

Browse files
theme generator - live preview
1 parent 61c26b1 commit 780d7fe

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

scripts/build.theme.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ async function run(argv) {
6262

6363
themes.forEach((theme) => {
6464
const buildThemeSourcePath = path.join(buildPath, 'lib', 'theme', theme)
65-
const buildColorsSourcePath = path.join(buildPath, 'lib', '_utils', 'colors.js')
6665

6766
const d = require(buildThemeSourcePath)
68-
const colors = require(buildColorsSourcePath)
6967

70-
fs.writeJsonSync(path.join(buildThemePath, `${theme}.json`), { ...d.default, colorPalette: colors.uiColorMap[theme] })
68+
fs.writeJsonSync(path.join(buildThemePath, `${theme}.json`), { ...d.default })
7169

7270
generalTheme.themes.push({
73-
[theme]: { ...d.default, colorPalette: colors.uiColorMap[theme] },
71+
[theme]: { ...d.default },
7472
})
7573
})
7674

src/common/hooks/use-app-theme.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react'
22
import { useDispatch, useSelector } from 'react-redux'
33
import { AnyAction } from 'redux'
44
import get from 'lodash/get'
5+
import isEmpty from 'lodash/isEmpty'
56

67
export type UseAppThemeType = {
78
getTheme: (url: string) => any
@@ -50,8 +51,8 @@ export function useAppTheme(options: UseAppThemeType) {
5051

5152
const getThemeData = useCallback(
5253
(currentTheme: string) => {
53-
if (appStore.configuration.previewTheme) {
54-
return appStore.configuration.previewTheme.theme
54+
if (!isEmpty(appStore.configuration.previewTheme)) {
55+
return appStore.configuration.previewTheme
5556
}
5657

5758
if (appTheme) {

src/components/Atomic/SimpleStripTable/SimpleStripTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FC } from 'react'
2+
23
import { Props, defaultProps } from './SimpleStripTable.types'
34
import * as styles from './SimpleStripTable.styles'
45
import Row from '../Grid/Row'

src/components/Atomic/_theme/siemens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { colors, colorsSiemens } from '../_utils/colors'
2-
import { required } from '../FormLabel/FormLabel.styles'
32

43
const theme = {
4+
colorPalette: colorsSiemens,
55
colors: {
66
ActionButton: {
77
floatingMenu: {

src/components/Atomic/_theme/template.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type LogoType = {
77
}
88

99
export const getThemeTemplate = (colors: any, logoProps: LogoType) => ({
10+
colorPalette: colors,
1011
colors: {
1112
ActionButton: {
1213
floatingMenu: {

0 commit comments

Comments
 (0)