click button to toggle extended examples

This commit is contained in:
Kevin Qi 2019-04-28 15:32:01 -07:00
parent fe5370c76d
commit 3df9aa545d

View File

@ -14,6 +14,8 @@ const Example: React.FunctionComponent<{ description: string }> = ({ description
);
function Demo() {
const [showAllExamples, setShowAllExamples] = React.useState(false);
return (
<div className="container">
<div className="row mt-5">
@ -97,13 +99,25 @@ function Demo() {
</div>
</Example>
<Example description="Dashboard style.">
<CircularProgressbar percentage={50} circleRatio={0.7} />
</Example>
<Example description="Dashboard style, counterclockwise.">
<CircularProgressbar percentage={50} circleRatio={0.7} counterClockwise />
</Example>
{showAllExamples ? (
<React.Fragment>
<Example description="Dashboard style.">
<CircularProgressbar percentage={50} circleRatio={0.7} />
</Example>
<Example description="Dashboard style, counterclockwise.">
<CircularProgressbar percentage={50} circleRatio={0.7} counterClockwise />
</Example>
</React.Fragment>
) : (
<div className="col-12 text-center">
<button
className="btn btn-link text-secondary"
onClick={() => setShowAllExamples(true)}
>
<small>Show more examples</small>
</button>
</div>
)}
</div>
<hr />