Skip to content

Commit

Permalink
Typescript support for Divider (#520)
Browse files Browse the repository at this point in the history
* First try for typescript support for Divider

* In the middle of using proptables from ts components in the storybook

* Lot's of lot's of tweeks to make prop tables in storybook working. This commit is kind of a proof of concept

* Remove classname, key and ref from props table

* Removed debug env

* Removed configuration of typescript in storybook main

* Remove old testing stuffs

* Remove old rollup typescript plugin

* Delete copy'n pasted babel typescript transpiler, we use rollup plugin instead

* Remove testing stuffs
  • Loading branch information
wenche authored and vnys committed Nov 13, 2020
1 parent 1bd85f7 commit b709eb8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
12 changes: 4 additions & 8 deletions libraries/core-react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import babel from '@rollup/plugin-babel'
import polyfill from 'rollup-plugin-polyfill'
import typescript from 'rollup-plugin-typescript2'
import typescript from '@rollup/plugin-typescript'

import pkg from './package.json'

const peerDeps = Object.keys(pkg.peerDependencies || {})
Expand All @@ -28,13 +29,8 @@ export default [
},
plugins: [
json(),
resolve({ extensions: ['.jsx', '.js'] }),
typescript({
tsconfig: 'tsconfig.json',
typescript: require('typescript'),
include: ['*.ts+(|x)', '**/*.ts+(|x)', '*.js+(|x)', '**/*.js+(|x)'],
exclude: ['node_modules/**'],
}),
resolve({ extensions }),
typescript(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled',
Expand Down
6 changes: 4 additions & 2 deletions libraries/core-react/src/Divider/Divider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Divider', () => {
expect(container.firstChild).toHaveStyleRule('margin-top', spacingMedium)
})
it('Sets backgroundColor to light according to color prop', () => {
const { container } = render(<Divider color="light" />)
const { container } = render(<Divider />)
expect(container.firstChild).toHaveStyleRule('background-color', light)
})
it('Sets backgroundColor to lighter according to color prop', () => {
Expand All @@ -41,7 +41,9 @@ describe('Divider', () => {
expect(container.firstChild).toHaveStyleRule('margin-top', spacingSmall)
})
it('Can extend the css for the component', () => {
const { container } = render(<StyledDivider variant="small" />)
const { container } = render(
<StyledDivider color="light" variant="small" />,
)
expect(container.firstChild).toHaveStyleRule('position', 'relative')
expect(container.firstChild).toHaveStyleRule('margin-top', spacingSmall)
})
Expand Down
1 change: 0 additions & 1 deletion libraries/core-react/src/Divider/Divider.tokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-nocheck
import { tokens } from '@equinor/eds-tokens'

const {
Expand Down
2 changes: 1 addition & 1 deletion libraries/core-react/src/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
/** Color variants
@default medium */
color?: 'lighter' | 'light' | 'medium'
/** Vertical spacings
/** Vertical spacings
@default medium */
variant?: 'small' | 'medium'
className?: string
Expand Down
1 change: 0 additions & 1 deletion libraries/core-react/src/Divider/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// @ts-nocheck
export { Divider } from './Divider'

0 comments on commit b709eb8

Please sign in to comment.