Skip to content

Commit

Permalink
v0.2.12
Browse files Browse the repository at this point in the history
# Enhancements
- Bump eslint to v7
- Add Overlay component
- Resolve prop warnings from Icon component
  • Loading branch information
junbong authored Oct 26, 2020
2 parents 9bb4f5f + 8a269cc commit 33cc145
Show file tree
Hide file tree
Showing 18 changed files with 1,489 additions and 404 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- restore_cache:
keys:
- design-system-dependencies-{{ checksum "package.json" }}
- run: npm install
- run: npm ci
- save_cache:
paths:
- node_modules
Expand Down
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module.exports = {
"extends": "@channel.io/eslint-config",
extends: ['@channel.io/eslint-config'],
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
rules: {
'no-restricted-imports': 'off',
'no-restricted-modules': 'off',
'react/jsx-props-no-spreading': 'off',
},
};
}
1,333 changes: 961 additions & 372 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@channel.io/design-system",
"version": "0.2.11",
"version": "0.2.12",
"description": "Design System by Channel",
"repository": {
"type": "git",
Expand Down Expand Up @@ -66,7 +66,7 @@
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.10.4",
"@channel.io/eslint-config": "^1.0.5",
"@channel.io/eslint-config": "^1.0.8",
"@channel.io/stylelint-config": "^1.1.0",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^11.0.2",
Expand All @@ -87,24 +87,23 @@
"@types/react": "^16.9.34",
"@types/styled-components": "^5.1.0",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"babel-eslint": "^8.2.6",
"babel-jest": "^26.2.2",
"babel-loader": "^8.1.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-preset-react-app": "^9.1.2",
"core-js": "^3.6.5",
"cross-env": "^7.0.2",
"eslint": "^5.16.0",
"eslint-config-airbnb-typescript": "^4.0.1",
"eslint-import-resolver-webpack": "^0.10.1",
"eslint": "^7.11.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^22.21.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^1.7.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.1.2",
"husky": "^4.2.5",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StylableComponentProps } from '../../types/ComponentProps'
import type { IconName } from '../Icon/generated'

export enum ButtonTheme {
Normal = 'normal'
Normal = 'normal',
}

export default interface ButtonProps extends StylableComponentProps {
Expand Down
10 changes: 5 additions & 5 deletions src/components/Icon/Icon.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { styled } from '../../styling/Theme'
import { IconStyledProps } from './Icon.types'

function getMargin({
marginTop,
marginRight,
marginBottom,
marginLeft,
margintop,
marginright,
marginbottom,
marginleft,
}: IconStyledProps): string {
return `${marginTop}px ${marginRight}px ${marginBottom}px ${marginLeft}px`
return `${margintop}px ${marginright}px ${marginbottom}px ${marginleft}px`
}

const Icon = styled.svg<IconStyledProps>`
Expand Down
8 changes: 4 additions & 4 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function Icon({
as={icons[name]}
width={size}
height={size}
marginTop={marginTop}
marginRight={marginRight}
marginBottom={marginBottom}
marginLeft={marginLeft}
margintop={marginTop}
marginright={marginRight}
marginbottom={marginBottom}
marginleft={marginLeft}
/>
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Icon/Icon.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export enum IconSize {

export interface IconStyledProps {
color?: string
marginTop: number
marginRight: number
marginBottom: number
marginLeft: number
margintop: number
marginright: number
marginbottom: number
marginleft: number
}

export default interface IconProps extends StylableComponentProps, Omit<SVGProps, 'ref'> {
Expand Down
115 changes: 115 additions & 0 deletions src/components/Overlay/Overlay.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/* External dependencies */
import React, { useRef } from 'react'
import { base } from 'paths.macro'

/* Internal dependencies */
import { getTitle } from '../../utils/utils'
import { styled } from '../../styling/Theme'
import Palette from '../../styling/Palette'
import Overlay from './Overlay'
import OverlayPosition from './OverlayPosition'

export default {
title: getTitle(base),
component: Overlay,
argTypes: {
placement: {
control: {
type: 'radio',
options: [
OverlayPosition.TopCenter,
OverlayPosition.TopLeft,
OverlayPosition.TopRight,
OverlayPosition.RightCenter,
OverlayPosition.RightTop,
OverlayPosition.RightBottom,
OverlayPosition.BottomCenter,
OverlayPosition.BottomLeft,
OverlayPosition.BottomRight,
OverlayPosition.LeftCenter,
OverlayPosition.LeftTop,
OverlayPosition.LeftBottom,
],
},
},
marginX: {
control: {
type: 'range',
min: -200,
max: 200,
step: 1,
},
},
marginY: {
control: {
type: 'range',
min: -200,
max: 200,
step: 1,
},
},
},
}

const Container = styled.div`
width: 600px;
height: 500px;
overflow: scroll;
border: 1px solid ${Palette.grey700};
`

const Wrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 900px;
height: 800px;
`

const Target = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 70px;
height: 40px;
background-color: ${Palette.grey300};
border-radius: 4px;
`

const Children = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 250px;
height: 150px;
background-color: ${Palette.grey500};
border-radius: 4px;
`

const Template = (props) => {
const targetRef = useRef<any>()

return (
<Container>
<Wrapper>
<Target ref={targetRef}>
target
</Target>
<Overlay
{...props}
target={targetRef.current}
>
<Children>overlay</Children>
</Overlay>
</Wrapper>
</Container>
)
}

export const Primary = Template.bind({})
Primary.args = {
show: false,
placement: OverlayPosition.BottomCenter,
marginX: 0,
marginY: 0,
}
26 changes: 26 additions & 0 deletions src/components/Overlay/Overlay.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Internal dependencies */
import { styled, css } from '../../styling/Theme'
import { StyledOverlayProps } from './Overlay.types'

export const Container = styled.div`
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
`

export const Wrapper = styled.div`
width: 100%;
height: 100%;
position: relative;
`

export const StyledOverlay = styled.div<StyledOverlayProps>`
position: absolute;
${props => props.isHidden && css`
visibility: hidden;
`}
`
Loading

0 comments on commit 33cc145

Please sign in to comment.