computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
743 B
32 lines
743 B
12 months ago
|
import { useState } from 'react';
|
||
|
|
||
|
type TipItemProps = {
|
||
|
title: string;
|
||
|
description: string;
|
||
|
};
|
||
|
export function TipItem(props: TipItemProps) {
|
||
|
const { title, description } = props;
|
||
|
|
||
|
const [isToggled, setIsToggled] = useState(false);
|
||
|
|
||
|
return (
|
||
|
<div className="flex flex-col">
|
||
|
{!isToggled && (
|
||
|
<div
|
||
|
onClick={() => setIsToggled(true)}
|
||
|
className="cursor-pointer rounded-lg sm:rounded-xl bg-black px-3 py-2 text-sm sm:text-base text-white"
|
||
|
>
|
||
|
{title}
|
||
|
</div>
|
||
|
)}
|
||
|
{isToggled && (
|
||
|
<p
|
||
|
className="rounded-lg sm:rounded-xl bg-gray-200 px-3 py-2 text-black text-sm sm:text-base"
|
||
|
>
|
||
|
{description}
|
||
|
</p>
|
||
|
)}
|
||
|
</div>
|
||
|
);
|
||
|
}
|