Skip to content

Commit

Permalink
apps/web: add more branches
Browse files Browse the repository at this point in the history
  • Loading branch information
qiushi1511 committed Oct 21, 2024
1 parent 8ce534d commit 44351fa
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions apps/web/app/feat1/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

import { useState } from "react";

function ToggleContent({ children }: { children?: React.ReactNode }) {
const [show, setShow] = useState(false);
function ToggleContent({
children,
defaultShow = false,
}: {
children?: React.ReactNode;
defaultShow?: boolean;
}) {
const [show, setShow] = useState(defaultShow);
return (
<div>
<button onClick={() => setShow(!show)}>Toggle</button>
Expand All @@ -13,18 +19,33 @@ function ToggleContent({ children }: { children?: React.ReactNode }) {
}

export default function Page() {
const ranNum = Math.round(Math.random() * 100);

return (
<>
<h1>Feat 1</h1>

<ToggleContent>
<p>
<span>P1:</span>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolorem,
voluptatem mollitia suscipit odio eos fugiat eum in molestias itaque
ex magni fuga deleniti dolores. Accusamus blanditiis reiciendis ab
quibusdam saepe.
</p>
</ToggleContent>
<ToggleContent defaultShow={true}>
<p>
<span>P2:</span>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolorem,
voluptatem mollitia suscipit odio eos fugiat eum in molestias itaque
ex magni fuga deleniti dolores. Accusamus blanditiis reiciendis ab
quibusdam saepe.
</p>
</ToggleContent>

{ranNum > 50 && <p>Random number is greater than 50</p>}
{ranNum <= 50 && <p>Random number is less than 50</p>}
</>
);
}

0 comments on commit 44351fa

Please sign in to comment.