Advertisement
Guest User

Stackoverflow 67721192

a guest
May 27th, 2021
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import React, { useState } from "react";
  3.  
  4. export const TopOptions = () => {
  5.   const [clickedButton, setClickedButton] = useState(1);
  6.  
  7.   const buttons = ["DELIVERY", "TAKEAWAY", "DINE IN"];
  8.  
  9.   return (
  10.     <>
  11.       <div className="flex flex-col border-b shadow-lg">
  12.         <div className="flex flex-col px-4">
  13.           <p className="text-xs pl-6 pt-4">PUNE</p>
  14.           <div className="flex flex-row items-center">
  15.             <select className="pl-2">
  16.               <option value="Kothrud Outlet">Kothrud Outlet</option>
  17.             </select>
  18.           </div>
  19.         </div>
  20.         <div
  21.           className=" bg-gray-100 my-5 text-center flex flex-row items-center justify-evenly text-sm rounded-md mx-4">
  22.           {buttons.map((btn, index) => (
  23.             <button className={"w-full py-3 font-bold " + (clickedButton === index ? "" : "text-gray-600")}
  24.                     onClick={() => {
  25.                       setClickedButton(index);
  26.                     }} key={"btn" + index}
  27.             >{btn}</button>
  28.           ))}
  29.         </div>
  30.       </div>
  31.     </>
  32.   );
  33. };
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement