-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Enhancements - Bump eslint to v7 - Add Overlay component - Resolve prop warnings from Icon component
- Loading branch information
Showing
18 changed files
with
1,489 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`} | ||
` |
Oops, something went wrong.