-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ScilifelabDataCentre/card_branch
Adding a Card Component with some prop options, testing them in App.tsx
- Loading branch information
Showing
2 changed files
with
52 additions
and
3 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,24 @@ | ||
import { ReactElement } from "react"; | ||
|
||
export default function CardComponent(prop: { classes: string, title: string, text: string, button: string }): ReactElement { | ||
const title: ReactElement = ( | ||
<h2 className="text-center text-white text-xl font-semibold">{prop.title}</h2> | ||
); | ||
|
||
var buttonClasses: string = 'btn bg-fuchsia-950 text-white hover:bg-fuchsia-800 active:bg-fuchsia-900 focus:outline-none focus:ring focus:ring-fuchsia-300'; | ||
const button: ReactElement = ( | ||
<div className="card-actions justify-center"> | ||
<button className={buttonClasses}>{prop.button}</button> | ||
</div> | ||
); | ||
|
||
return ( | ||
<div className={"card " + prop.classes}> | ||
<div className="card-body"> | ||
{prop.title && title} | ||
<p className="text-center content-end">{prop.text}</p> | ||
{prop.button && button} | ||
</div> | ||
</div> | ||
); | ||
} |