From 7567047e51b4b4b241fe95ba52b8852db4f70825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Wed, 16 Feb 2022 11:44:00 +0100 Subject: [PATCH] Use CSS Modules --- .husky/pre-commit | 1 + .../callout/{callout.scss => callout.module.scss} | 0 libs/ui-toolkit/src/components/callout/callout.tsx | 13 ++++++++----- libs/ui-toolkit/src/index.ts | 2 -- libs/ui-toolkit/src/lib/ui-toolkit.module.scss | 0 libs/ui-toolkit/src/lib/ui-toolkit.spec.tsx | 10 ---------- libs/ui-toolkit/src/lib/ui-toolkit.stories.tsx | 12 ------------ libs/ui-toolkit/src/lib/ui-toolkit.tsx | 14 -------------- 8 files changed, 9 insertions(+), 43 deletions(-) rename libs/ui-toolkit/src/components/callout/{callout.scss => callout.module.scss} (100%) delete mode 100644 libs/ui-toolkit/src/lib/ui-toolkit.module.scss delete mode 100644 libs/ui-toolkit/src/lib/ui-toolkit.spec.tsx delete mode 100644 libs/ui-toolkit/src/lib/ui-toolkit.stories.tsx delete mode 100644 libs/ui-toolkit/src/lib/ui-toolkit.tsx diff --git a/.husky/pre-commit b/.husky/pre-commit index f4ab6825e..8ddb49c74 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,5 @@ . "$(dirname "$0")/_/husky.sh" yarn lint-staged +nx affected:build --uncommitted nx affected:test --uncommitted diff --git a/libs/ui-toolkit/src/components/callout/callout.scss b/libs/ui-toolkit/src/components/callout/callout.module.scss similarity index 100% rename from libs/ui-toolkit/src/components/callout/callout.scss rename to libs/ui-toolkit/src/components/callout/callout.module.scss diff --git a/libs/ui-toolkit/src/components/callout/callout.tsx b/libs/ui-toolkit/src/components/callout/callout.tsx index 29f7331e7..5017eb563 100644 --- a/libs/ui-toolkit/src/components/callout/callout.tsx +++ b/libs/ui-toolkit/src/components/callout/callout.tsx @@ -1,4 +1,4 @@ -// import './callout.scss'; +import styles from './callout.module.scss'; import React from 'react'; export const Callout = ({ @@ -12,12 +12,15 @@ export const Callout = ({ intent?: 'success' | 'error' | 'warn' | 'action'; icon?: React.ReactNode; }) => { - const className = ['callout', intent ? `callout--${intent}` : ''].join(' '); + const className = [ + styles['callout'], + intent ? styles[`callout--${intent}`] : '', + ].join(' '); return (
- {icon &&
{icon}
} -
- {title &&

{title}

} + {icon &&
{icon}
} +
+ {title &&

{title}

} {children}
diff --git a/libs/ui-toolkit/src/index.ts b/libs/ui-toolkit/src/index.ts index 964b968c4..4535fe7f8 100644 --- a/libs/ui-toolkit/src/index.ts +++ b/libs/ui-toolkit/src/index.ts @@ -1,7 +1,5 @@ import * as EthereumUtils from './utils/web3'; -export * from './lib/ui-toolkit'; - export { Callout } from './components/callout'; export { EtherscanLink } from './components/etherscan-link'; export { EthereumUtils }; diff --git a/libs/ui-toolkit/src/lib/ui-toolkit.module.scss b/libs/ui-toolkit/src/lib/ui-toolkit.module.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/libs/ui-toolkit/src/lib/ui-toolkit.spec.tsx b/libs/ui-toolkit/src/lib/ui-toolkit.spec.tsx deleted file mode 100644 index 3877f1b3e..000000000 --- a/libs/ui-toolkit/src/lib/ui-toolkit.spec.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from '@testing-library/react'; - -import UiToolkit from './ui-toolkit'; - -describe('UiToolkit', () => { - it('should render successfully', () => { - const { baseElement } = render(); - expect(baseElement).toBeTruthy(); - }); -}); diff --git a/libs/ui-toolkit/src/lib/ui-toolkit.stories.tsx b/libs/ui-toolkit/src/lib/ui-toolkit.stories.tsx deleted file mode 100644 index 1136b167c..000000000 --- a/libs/ui-toolkit/src/lib/ui-toolkit.stories.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Story, Meta } from '@storybook/react'; -import { UiToolkit, UiToolkitProps } from './ui-toolkit'; - -export default { - component: UiToolkit, - title: 'UiToolkit', -} as Meta; - -const Template: Story = (args) => ; - -export const Primary = Template.bind({}); -Primary.args = {}; diff --git a/libs/ui-toolkit/src/lib/ui-toolkit.tsx b/libs/ui-toolkit/src/lib/ui-toolkit.tsx deleted file mode 100644 index 49718d09f..000000000 --- a/libs/ui-toolkit/src/lib/ui-toolkit.tsx +++ /dev/null @@ -1,14 +0,0 @@ -// import './ui-toolkit.module.scss'; - -/* eslint-disable-next-line */ -export interface UiToolkitProps {} - -export function UiToolkit(props: UiToolkitProps) { - return ( -
-

Welcome to UiToolkit!

-
- ); -} - -export default UiToolkit;