-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change suffix to ts(x) * Change suffix to tsx * add types for tokens * typify Dialog * fix stuff
- Loading branch information
Showing
10 changed files
with
155 additions
and
177 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { forwardRef } from 'react' | ||
import styled, { css } from 'styled-components' | ||
import { dialog as tokens } from './Dialog.tokens' | ||
|
||
const { spacingsMedium } = tokens | ||
|
||
const StyledActions = styled.div<Props>` | ||
min-height: 48px; | ||
padding: 0 ${spacingsMedium}; | ||
align-self: end; | ||
justify-self: start; | ||
${({ children }) => | ||
!children && | ||
css` | ||
min-height: initial; | ||
height: 8px; | ||
`} | ||
` | ||
|
||
type Props = React.HTMLAttributes<HTMLDivElement> | ||
|
||
export const Actions = forwardRef<HTMLDivElement, Props>( | ||
function EdsDialogActions({ children, ...props }, ref) { | ||
return ( | ||
<StyledActions ref={ref} {...props}> | ||
{children} | ||
</StyledActions> | ||
) | ||
}, | ||
) | ||
|
||
Actions.displayName = 'eds-dialog-actions' |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { forwardRef, Fragment } from 'react' | ||
import styled, { css } from 'styled-components' | ||
import { Divider } from '../Divider' | ||
import { typographyTemplate } from '../_common/templates' | ||
|
||
import { dialog as tokens } from './Dialog.tokens' | ||
|
||
const { description, spacingsMedium } = tokens | ||
|
||
const StyledCustomContent = styled.div<Props>` | ||
${typographyTemplate(description)} | ||
min-height: 80px; | ||
margin-bottom: ${spacingsMedium}; | ||
align-self: stretch; | ||
justify-self: stretch; | ||
padding: 0 ${spacingsMedium}; | ||
${({ scrollable }) => | ||
scrollable && | ||
css` | ||
min-height: initial; | ||
height: 104px; | ||
overflow-y: auto; | ||
`} | ||
` | ||
|
||
const StyledDivider = styled(Divider)` | ||
width: 100%; | ||
margin-top: 0; | ||
margin-bottom: ${spacingsMedium}; | ||
` | ||
|
||
type Props = { | ||
/** @ignore */ | ||
scrollable?: boolean | ||
} & React.HTMLAttributes<HTMLDivElement> | ||
|
||
export const CustomContent = forwardRef<HTMLDivElement, Props>( | ||
function EdsDialogCustomContent( | ||
{ children, className = '', scrollable = false, ...rest }, | ||
ref, | ||
) { | ||
return ( | ||
<Fragment> | ||
<StyledCustomContent | ||
className={className} | ||
scrollable={scrollable} | ||
id="eds-dialog-customcontent" | ||
ref={ref} | ||
{...rest} | ||
> | ||
{children} | ||
</StyledCustomContent> | ||
|
||
{children && scrollable && ( | ||
<StyledDivider color="medium" variant="small" /> | ||
)} | ||
</Fragment> | ||
) | ||
}, | ||
) | ||
|
||
CustomContent.displayName = 'eds-dialog-customcontent' |
2 changes: 1 addition & 1 deletion
2
...ies/core-react/src/Dialog/Dialog.test.jsx → ...ies/core-react/src/Dialog/Dialog.test.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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.