-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update all the files to typescript. Card type is not correct yet. * Added wrapper type to the index file and made props nullable. * Fixed tests.
- Loading branch information
Showing
12 changed files
with
140 additions
and
193 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
libraries/core-react/src/Card/Card.test.jsx → libraries/core-react/src/Card/Card.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
1 change: 0 additions & 1 deletion
1
libraries/core-react/src/Card/Card.tokens.js → libraries/core-react/src/Card/Card.tokens.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,4 +1,3 @@ | ||
// @ts-nocheck | ||
import { tokens } from '@equinor/eds-tokens' | ||
|
||
const { | ||
|
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.
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,41 @@ | ||
import React, { forwardRef } from 'react' | ||
import styled from 'styled-components' | ||
import { Typography } from '../Typography' | ||
|
||
type Props = { | ||
alignRight?: boolean | ||
meta?: string | ||
} & React.HTMLAttributes<HTMLDivElement> | ||
|
||
const StyledCardActions = styled.div<React.CSSProperties>` | ||
display: grid; | ||
grid-gap: 8px; | ||
grid-auto-flow: column; | ||
grid-auto-columns: max-content; | ||
align-items: center; | ||
justify-content: ${({ justifyContent }) => justifyContent}; | ||
` | ||
|
||
export const CardActions = forwardRef<HTMLDivElement, Props>( | ||
function EdsCardActions( | ||
{ children, className = '', alignRight = false, meta = '', ...rest }, | ||
ref, | ||
) { | ||
const justifyContent = alignRight ? 'flex-end' : 'flex-start' | ||
const props = { | ||
...rest, | ||
className, | ||
ref, | ||
justifyContent, | ||
} | ||
|
||
return ( | ||
<StyledCardActions {...props}> | ||
{children} | ||
{meta !== '' && <Typography variant="caption">{meta}</Typography>} | ||
</StyledCardActions> | ||
) | ||
}, | ||
) | ||
|
||
CardActions.displayName = 'eds-card-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,30 @@ | ||
import React, { forwardRef } from 'react' | ||
import styled from 'styled-components' | ||
|
||
import { card as tokens } from './Card.tokens' | ||
|
||
type Props = React.HTMLAttributes<HTMLDivElement> | ||
|
||
const StyledCardHeader = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
> :not(:first-child) { | ||
margin-left: ${tokens.spacings.left}; | ||
} | ||
` | ||
|
||
export const CardHeader = forwardRef<HTMLDivElement, Props>( | ||
function EdsCardHeader({ children, className = '', ...rest }, ref) { | ||
const props = { | ||
...rest, | ||
className, | ||
ref, | ||
} | ||
|
||
return <StyledCardHeader {...props}>{children}</StyledCardHeader> | ||
}, | ||
) | ||
|
||
CardHeader.displayName = 'eds-card-header' |
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,24 @@ | ||
import React, { forwardRef } from 'react' | ||
import styled from 'styled-components' | ||
|
||
type Props = React.HTMLAttributes<HTMLDivElement> | ||
|
||
const StyledCardHeaderTitle = styled.div` | ||
display: grid; | ||
flex-grow: 2; | ||
grid-auto-columns: auto; | ||
` | ||
|
||
export const CardHeaderTitle = forwardRef<HTMLDivElement, Props>( | ||
function EdsCardHeaderTitle({ children, className = '', ...rest }, ref) { | ||
const props = { | ||
...rest, | ||
className, | ||
ref, | ||
} | ||
|
||
return <StyledCardHeaderTitle {...props}>{children}</StyledCardHeaderTitle> | ||
}, | ||
) | ||
|
||
CardHeaderTitle.displayName = 'eds-card-header-title' |
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
12 changes: 10 additions & 2 deletions
12
libraries/core-react/src/Card/index.js → libraries/core-react/src/Card/index.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
Empty file.