-
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.
- Loading branch information
1 parent
8711574
commit 81982ee
Showing
3 changed files
with
32 additions
and
4 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 |
---|---|---|
@@ -1,12 +1,24 @@ | ||
import { MoneyButton } from "artistic-components"; | ||
import Octocat from "./Octocat"; | ||
import { FlexBox } from "@ui5/webcomponents-react"; | ||
import SponsorDialog from "../SponsorDialog/SponsorDialog"; | ||
import { useState } from "react"; | ||
|
||
export default function Header() { | ||
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false); | ||
const clickHandler = () => { | ||
setIsDialogOpen(true); | ||
} | ||
return ( | ||
<div> | ||
<> | ||
<p className="marquee"> | ||
Welcome to my site. I'm SNORLAX. | ||
</p> | ||
<Octocat /> | ||
</div> | ||
<FlexBox> | ||
<MoneyButton style={{ "margin": "1rem" }} onClick={clickHandler}> Sponsor me </MoneyButton> | ||
<Octocat /> | ||
</FlexBox> | ||
<SponsorDialog open={isDialogOpen} closeHandler={() => { setIsDialogOpen(false) }} /> | ||
</> | ||
) | ||
} |
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,17 @@ | ||
import { Bar, Button, Dialog, DialogPropTypes } from "@ui5/webcomponents-react"; | ||
import { MouseEventHandler } from "react"; | ||
import { createPortal } from "react-dom"; | ||
|
||
interface SponsorDialogProps extends DialogPropTypes { | ||
closeHandler: MouseEventHandler<HTMLButtonElement>; | ||
} | ||
|
||
export default function SponsorDialog(props: SponsorDialogProps) { | ||
const { open, closeHandler, ...rest } = props; | ||
return ( | ||
createPortal( | ||
<Dialog open={open} {...rest} footer={<Bar design="Footer" endContent={<button onClick={closeHandler}>Close</button>} />}></Dialog>, | ||
document.body | ||
) | ||
) | ||
} |
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