-
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.
Abstract away card component. (#154)
* Add Card component with story. * Replace card usage throughout codebase. (EventDetails is messed up.) * Add prop passthrough to Card. * Fix EventDetails component. * Add title prop to card. * Refactor usage of CardHeader. * Change Card export syntax.
- Loading branch information
1 parent
f565de4
commit 458800e
Showing
16 changed files
with
236 additions
and
222 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { Story, Meta } from '@storybook/react'; | ||
|
||
import { Card, CardProps } from './Card'; | ||
|
||
export default { | ||
title: 'Cards/Card', | ||
component: Card, | ||
} as Meta; | ||
|
||
const Template: Story<CardProps> = args => { | ||
const { children, title } = args; | ||
return <Card title={title}>{children}</Card>; | ||
}; | ||
|
||
export const SampleCard = Template.bind({}); | ||
SampleCard.args = { | ||
children: <h3>Put stuff here!</h3>, | ||
}; | ||
|
||
export const SampleCardWithTitle = Template.bind({}); | ||
SampleCardWithTitle.args = { | ||
children: <h3>This is the body</h3>, | ||
title: '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { | ||
Card as MuiCard, | ||
CardHeader as MuiCardHeader, | ||
CardContent as MuiCardContent, | ||
} from '@material-ui/core'; | ||
|
||
export interface CardProps { | ||
title?: string; | ||
children: JSX.Element; | ||
} | ||
|
||
export function Card({ children, title, ...props }: CardProps): JSX.Element { | ||
return ( | ||
<MuiCard elevation={3} {...props}> | ||
{title ? <MuiCardHeader title={title} /> : null} | ||
<MuiCardContent>{children}</MuiCardContent> | ||
</MuiCard> | ||
); | ||
} |
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 { Card } from './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
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: 0 additions & 8 deletions
8
frontend/src/pages/EventDetailsPage/components/EventDetails/styles.js
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
Oops, something went wrong.