From f96170c40004374acc554f0c0cc6450447e529a0 Mon Sep 17 00:00:00 2001 From: wojtek-krysiak Date: Sat, 1 Aug 2020 18:54:47 +0200 Subject: [PATCH] fix: design system types --- src/admin-bro-options.interface.ts | 8 +++----- .../components/spec/test-context-provider.tsx | 3 +-- src/frontend/layout-template.tsx | 2 +- src/frontend/login-template.tsx | 2 +- src/frontend/styles/combine-styles.ts | 15 --------------- src/frontend/styles/styled-components.d.ts | 2 +- 6 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 src/frontend/styles/combine-styles.ts diff --git a/src/admin-bro-options.interface.ts b/src/admin-bro-options.interface.ts index 12e952e88..9eb1c21f8 100644 --- a/src/admin-bro-options.interface.ts +++ b/src/admin-bro-options.interface.ts @@ -1,4 +1,4 @@ -import { DefaultTheme as Theme } from '@admin-bro/design-system' +import { ThemeOverride } from '@admin-bro/design-system' import BaseResource from './backend/adapters/base-resource' import BaseDatabase from './backend/adapters/base-database' @@ -113,7 +113,7 @@ export default interface AdminBroOptions { */ version?: VersionSettings; /** - * Options which are related to the branding. + * Options which are related to the ht. */ branding?: BrandingOptions; /** @@ -297,7 +297,7 @@ export type BrandingOptions = { /** * CSS theme. */ - theme?: Partial; + theme?: Partial; /** * Flag indicates if `SoftwareBrothers` tiny hart icon should be visible on the bottom sidebar. */ @@ -368,5 +368,3 @@ export interface AdminBroOptionsWithDefault extends AdminBroOptions { }; pages: Record; } - -export { Theme } diff --git a/src/frontend/components/spec/test-context-provider.tsx b/src/frontend/components/spec/test-context-provider.tsx index 6c2ad1b3b..52aa9dfdd 100644 --- a/src/frontend/components/spec/test-context-provider.tsx +++ b/src/frontend/components/spec/test-context-provider.tsx @@ -1,8 +1,7 @@ import React, { ReactNode } from 'react' - import { StaticRouter } from 'react-router-dom' import { ThemeProvider } from 'styled-components' -import combineStyles from '../../styles/combine-styles' +import { combineStyles } from '@admin-bro/design-system' const theme = combineStyles({}) diff --git a/src/frontend/layout-template.tsx b/src/frontend/layout-template.tsx index a5d446065..559069e33 100644 --- a/src/frontend/layout-template.tsx +++ b/src/frontend/layout-template.tsx @@ -4,11 +4,11 @@ import { renderToString } from 'react-dom/server' import { StaticRouter } from 'react-router-dom' import { Provider } from 'react-redux' import { ThemeProvider } from 'styled-components' +import { combineStyles } from '@admin-bro/design-system' import App from './components/application' import ViewHelpers from '../backend/utils/view-helpers' import initializeStore from './store' -import combineStyles from './styles/combine-styles' import AdminBro from '../admin-bro' import { CurrentAdmin } from '../current-admin.interface' diff --git a/src/frontend/login-template.tsx b/src/frontend/login-template.tsx index 565c662ee..45315c37c 100644 --- a/src/frontend/login-template.tsx +++ b/src/frontend/login-template.tsx @@ -7,6 +7,7 @@ import { I18nextProvider } from 'react-i18next' import i18n from 'i18next' import { Provider } from 'react-redux' +import { combineStyles } from '@admin-bro/design-system' import LoginComponent from './components/login' import AdminBro from '../admin-bro' @@ -15,7 +16,6 @@ import createStore, { initializeLocale, ReduxState, } from './store/store' -import combineStyles from './styles/combine-styles' import ViewHelpers from '../backend/utils/view-helpers' type LoginTemplateAttributes = { diff --git a/src/frontend/styles/combine-styles.ts b/src/frontend/styles/combine-styles.ts deleted file mode 100644 index cc2453ed0..000000000 --- a/src/frontend/styles/combine-styles.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { merge } from 'lodash' -import { theme, DefaultTheme as Theme } from '@admin-bro/design-system' - -const combineStyles = (newTheme: Partial): Theme => { - const merged = merge(theme, newTheme) - if (newTheme.font) { - return { - ...merged, - font: newTheme.font, - } - } - return merged -} - -export default combineStyles diff --git a/src/frontend/styles/styled-components.d.ts b/src/frontend/styles/styled-components.d.ts index a6f37c645..b8be4cb44 100644 --- a/src/frontend/styles/styled-components.d.ts +++ b/src/frontend/styles/styled-components.d.ts @@ -1,4 +1,4 @@ -import { DefaultTheme as Theme } from '@admin-bro/design-system' +import { Theme } from '@admin-bro/design-system' declare module 'styled-components' { // eslint-disable-next-line @typescript-eslint/no-empty-interface