-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
45 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { contract } from '../ThemeProvider/themes/contract.css'; | ||
|
||
export const field = style({ | ||
borderTopStyle: 'groove', | ||
borderTopWidth: contract.space[2], | ||
borderTopColor: contract.colors.borderLighter, | ||
borderLeftStyle: 'groove', | ||
borderLeftWidth: contract.space[2], | ||
borderLeftColor: contract.colors.borderLighter, | ||
borderBottomStyle: 'solid', | ||
borderBottomWidth: contract.space[1], | ||
borderBottomColor: contract.colors.borderDark, | ||
borderRightStyle: 'solid', | ||
borderRightWidth: contract.space[1], | ||
borderRightColor: contract.colors.borderDark, | ||
boxShadow: `1px 1px 0 0 ${contract.colors.borderLighter}`, | ||
}); | ||
|
||
export const legend = style({ | ||
paddingLeft: contract.space[4], | ||
paddingRight: contract.space[1], | ||
}); |
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,42 +1,17 @@ | ||
import React, { forwardRef } from 'react'; | ||
import styled, { th } from '@xstyled/styled-components'; | ||
|
||
const Field = styled.fieldset` | ||
border-top-style: groove; | ||
border-top-width: 2; | ||
border-top-color: borderLighter; | ||
border-left-style: groove; | ||
border-left-width: 2; | ||
border-left-color: borderLighter; | ||
border-bottom-style: solid; | ||
border-bottom-width: 1; | ||
border-bottom-color: borderDark; | ||
border-right-style: solid; | ||
border-right-width: 1; | ||
border-right-color: borderDark; | ||
box-shadow: 1px 1px 0 0 ${th('colors.borderLighter')}; | ||
`; | ||
|
||
const Legend = styled.legend` | ||
padding-left: 4px; | ||
padding-right: 1px; | ||
`; | ||
import * as styles from './Fieldset.css'; | ||
import { Frame, FrameProps } from '../Frame/Frame'; | ||
|
||
export type FieldSetProps = { | ||
legend?: string; | ||
} & React.HTMLAttributes<HTMLFieldSetElement>; | ||
} & React.HTMLAttributes<HTMLFieldSetElement> & | ||
FrameProps; | ||
|
||
const Fieldset = forwardRef<HTMLFieldSetElement, FieldSetProps>( | ||
export const Fieldset = forwardRef<HTMLFieldSetElement, FieldSetProps>( | ||
({ legend, children, ...rest }, ref) => ( | ||
<Field {...rest} ref={ref}> | ||
{legend && <Legend>{legend}</Legend>} | ||
<Frame as="fieldset" {...rest} ref={ref} className={styles.field}> | ||
{legend && <legend className={styles.legend}>{legend}</legend>} | ||
{children} | ||
</Field> | ||
</Frame> | ||
), | ||
); | ||
|
||
export default Fieldset; |
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,3 +1,3 @@ | ||
import Fieldset from './Fieldset'; | ||
import { Fieldset } from './Fieldset'; | ||
|
||
export default Fieldset; |
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