-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: buttonactioncalloutcard addition
- Loading branch information
Showing
15 changed files
with
202 additions
and
18 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
27 changes: 27 additions & 0 deletions
27
.storybook/recipes/ButtonActionCalloutCard/ButtonActionCalloutCard.module.css
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,27 @@ | ||
@import '../../../src/design-tokens/mixins.css'; | ||
|
||
/*------------------------------------*\ | ||
# BUTTON ACTION CALLOUT CARD | ||
\*------------------------------------*/ | ||
|
||
/** | ||
* 1) Card elevated to drive attention and give an action | ||
*/ | ||
|
||
/** | ||
* Button action callout card body inner | ||
* 1) Wrapper around the description and button | ||
*/ | ||
.button-action-callout-card__body-inner { | ||
display: flex; | ||
align-items: flex-start; | ||
flex-direction: column; | ||
gap: var(--eds-size-2); | ||
margin-top: var(--eds-size-half); | ||
|
||
@media all and (min-width: $eds-bp-md) { | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.storybook/recipes/ButtonActionCalloutCard/ButtonActionCalloutCard.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,21 @@ | ||
import { StoryObj, Meta } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import { ButtonActionCalloutCard } from './ButtonActionCalloutCard'; | ||
import { Button } from '../../../src'; | ||
|
||
export default { | ||
title: 'Recipes/ButtonActionCalloutCard', | ||
component: ButtonActionCalloutCard, | ||
} as Meta<Args>; | ||
|
||
type Args = React.ComponentProps<typeof ButtonActionCalloutCard>; | ||
|
||
export const Default: StoryObj<Args> = { | ||
args: { | ||
title: 'Do This Checkpoint', | ||
children: | ||
'Develop the text of your Body Book, crafting evidence-supported explanations on how the body is organized and its functions.', | ||
actions: <Button variant="primary">Preview</Button>, | ||
}, | ||
}; |
69 changes: 69 additions & 0 deletions
69
.storybook/recipes/ButtonActionCalloutCard/ButtonActionCalloutCard.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,69 @@ | ||
import clsx from 'clsx'; | ||
import React, { ReactNode } from 'react'; | ||
import styles from './ButtonActionCalloutCard.module.css'; | ||
import { Button, Card, Heading, Text } from '../../../src'; | ||
|
||
export interface Props { | ||
/** | ||
* Slot for buttons or other calls to action | ||
*/ | ||
actions?: ReactNode; | ||
/** | ||
* CSS class names that can be appended to the component. | ||
*/ | ||
className?: string; | ||
/** | ||
* Child node(s) that can be nested inside component | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Title of the card | ||
*/ | ||
title?: string; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const ButtonActionCalloutCard = ({ | ||
actions, | ||
className, | ||
title, | ||
children, | ||
...other | ||
}: Props) => { | ||
const componentClassName = clsx( | ||
styles['button-action-callout-card'], | ||
className, | ||
{}, | ||
); | ||
return ( | ||
<Card className={componentClassName} elevation="raised" {...other}> | ||
<Card.Body className={styles['button-action-callout-card__body']}> | ||
<Heading | ||
as="h3" | ||
className={styles['button-action-callout-card__heading']} | ||
size="h5" | ||
> | ||
{title} | ||
</Heading> | ||
<div className={styles['button-action-callout-card__body-inner']}> | ||
{children && ( | ||
<Text | ||
as="div" | ||
className={styles['button-action-callout-card__description']} | ||
size="sm" | ||
> | ||
{children} | ||
</Text> | ||
)} | ||
{actions && ( | ||
<div className={styles['button-action-callout-card__actions']}> | ||
{actions} | ||
</div> | ||
)} | ||
</div> | ||
</Card.Body> | ||
</Card> | ||
); | ||
}; |
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 @@ | ||
export { ButtonActionCalloutCard as default } from './ButtonActionCalloutCard'; |
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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