-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Styled ExpandableTextfieldIcon (#189)
* feat: create expandable * feat: create expandabletextfield icon * feat: update customCss to expandabletextfield * feat: add onChange prop to stories * feat: update customCss * feat: add required props to stories * remove HOC and custom class Co-authored-by: Takeichi Kanzaki Cabrera <[email protected]>
- Loading branch information
Showing
41 changed files
with
708 additions
and
135 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
8 changes: 5 additions & 3 deletions
8
packages/styled-components/src/components/containers/Grid/Grid.styled.ts
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,6 +1,8 @@ | ||
import styled from 'styled-components'; | ||
import { withCustomCss } from 'utils/withCustomCss'; | ||
import { customCss } from 'utils/customCss'; | ||
import { StyledCssProps } from 'components/Components.styled.types'; | ||
|
||
export const StyledGrid = withCustomCss(styled.div` | ||
export const StyledGrid = styled.div<StyledCssProps>` | ||
display: grid; | ||
`); | ||
${(props) => customCss(props)} | ||
`; |
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
7 changes: 4 additions & 3 deletions
7
packages/styled-components/src/components/containers/Section/Section.styled.ts
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,8 @@ | ||
import styled from 'styled-components'; | ||
import { withCustomCss } from 'utils/withCustomCss'; | ||
import { customCss } from 'utils/customCss'; | ||
import { StyledCssProps } from 'components/Components.styled.types'; | ||
|
||
export const StyledSection = withCustomCss(styled.section<StyledCssProps>` | ||
export const StyledSection = styled.section<StyledCssProps>` | ||
margin-bottom: 1rem; | ||
`); | ||
${(props) => customCss(props)} | ||
`; |
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
7 changes: 4 additions & 3 deletions
7
packages/styled-components/src/components/containers/SectionChild/SectionChild.styled.ts
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,10 +1,11 @@ | ||
import styled from 'styled-components'; | ||
import { withCustomCss } from 'utils/withCustomCss'; | ||
import { customCss } from 'utils/customCss'; | ||
import { StyledCssProps } from 'components/Components.styled.types'; | ||
|
||
type Props = StyledCssProps; | ||
|
||
export const StyledSectionChild = withCustomCss(styled.div<Props>` | ||
export const StyledSectionChild = styled.div<Props>` | ||
padding-top: 2rem; | ||
padding-bottom: 2rem; | ||
`); | ||
${(props) => customCss(props)} | ||
`; |
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
44 changes: 44 additions & 0 deletions
44
...onents/src/components/primitives/Form/ExpandableTextField/ExpandableTextField.stories.tsx
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,44 @@ | ||
import React from 'react'; | ||
import { ExpandableTextField } from '.'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { text, select } from '@storybook/addon-knobs'; | ||
|
||
export default { | ||
title: 'Primitives/Form/ExpandableTextField', | ||
component: ExpandableTextField, | ||
}; | ||
|
||
export const Shapes = () => ( | ||
<> | ||
<h1>ExpandableTextField shapes</h1> | ||
{Object.keys(ExpandableTextField.Shapes).map((shape: any, i) => ( | ||
<div key={i}> | ||
<ExpandableTextField | ||
shape={ExpandableTextField.Shapes[shape]} | ||
placeholder={shape} | ||
onChange={action('On change')} | ||
/> | ||
<br /> | ||
</div> | ||
))} | ||
</> | ||
); | ||
|
||
export const Playground = () => ( | ||
<> | ||
<h1>Playground</h1> | ||
<ExpandableTextField | ||
placeholder={text('Placeholder', 'placeholder')} | ||
shape={select( | ||
'Shape', | ||
ExpandableTextField.Shapes, | ||
ExpandableTextField.Shapes.Rounded | ||
)} | ||
customCss={text( | ||
'Custom css', | ||
'background: #c5c5ff; border: 1px dashed #004fff; padding: 10px;' | ||
)} | ||
onChange={action('On change')} | ||
/> | ||
</> | ||
); |
73 changes: 73 additions & 0 deletions
73
...mponents/src/components/primitives/Form/ExpandableTextField/ExpandableTextField.styled.ts
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,73 @@ | ||
import { StyledCssProps } from 'components/Components.styled.types'; | ||
import styled from 'styled-components'; | ||
import { customCss } from 'utils/customCss'; | ||
import { getTheme } from 'utils/getTheme'; | ||
|
||
export const StyledWrapper = styled.div<StyledCssProps>` | ||
position: relative; | ||
width: 100%; | ||
${(props) => customCss(props)} | ||
`; | ||
|
||
export const StyledPlaceholder = styled.div<StyledCssProps>` | ||
line-height: 1.5rem; | ||
pointer-events: none; | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
left: 1rem; | ||
z-index: 20; | ||
color: ${(props) => getTheme(props).colors.outlineFormFilled}; | ||
font-size: ${(props) => getTheme(props).Typography.sm.fontSize.form}; | ||
font-family: ${(props) => getTheme(props).Typography.sm.fontFamily.form}; | ||
@media (min-width: ${(props) => getTheme(props).breakpoints.md}) { | ||
font-size: ${(props) => getTheme(props).Typography.md.fontSize.form}; | ||
font-family: ${(props) => getTheme(props).Typography.md.fontFamily.form}; | ||
} | ||
`; | ||
|
||
export const StyledExpandable = styled.div<StyledCssProps>` | ||
line-height: 1.5rem; | ||
background-color: ${(props) => getTheme(props).colors.fillFormEnabled}; | ||
display: block; | ||
width: 100%; | ||
color: ${(props) => getTheme(props).Typography.colors.dark100}; | ||
z-index: 10; | ||
font-size: ${(props) => getTheme(props).Typography.sm.fontSize.form}; | ||
font-family: ${(props) => getTheme(props).Typography.sm.fontFamily.form}; | ||
appearance: none; | ||
border-width: 1px; | ||
border-style: solid; | ||
border-color: ${(props) => getTheme(props).colors.outlineFormFilled}; | ||
min-height: 2.625rem; | ||
height: 2.625rem; | ||
position: relative; | ||
left: 0; | ||
top: 0; | ||
padding: 0.625rem 1rem; | ||
resize: none; | ||
box-sizing: border-box; | ||
&.rounded { | ||
border-radius: ${(props) => getTheme(props).Input.borderRadius.rounded}; | ||
} | ||
&.semiRounded { | ||
border-radius: ${(props) => getTheme(props).Input.borderRadius.semiRounded}; | ||
} | ||
&.rectangle { | ||
border-radius: ${(props) => getTheme(props).Input.borderRadius.rectangle}; | ||
} | ||
&:focus { | ||
border-color: ${(props) => getTheme(props).colors.outlineFormFocus}; | ||
outline: none; | ||
} | ||
@media (min-width: ${(props) => getTheme(props).breakpoints.md}) { | ||
min-height: 3rem; | ||
height: 3rem; | ||
font-size: ${(props) => getTheme(props).Typography.md.fontSize.form}; | ||
font-family: ${(props) => getTheme(props).Typography.md.fontFamily.form}; | ||
} | ||
`; |
Oops, something went wrong.