diff --git a/src/App.js b/src/App.js index 39167fb..66072da 100644 --- a/src/App.js +++ b/src/App.js @@ -97,17 +97,17 @@ function App() { {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} - + {/* */} {/* */} - + {/* */} {/* */} {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} {/* */} @@ -143,10 +143,10 @@ function App() { {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} diff --git a/src/components/SelectYear/index.js b/src/components/SelectYear/index.js index cee05d8..8121f5d 100644 --- a/src/components/SelectYear/index.js +++ b/src/components/SelectYear/index.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useRef } from "react"; import ScrollContainer from "react-indiana-drag-scroll"; import "./index.scss"; @@ -10,6 +10,12 @@ import Month from "./Month.js"; const SelectYear = ({ items }) => { const [selectedYear, setSelectedYear] = useState(null); + const inputRef = useRef(); + + function focus() { + console.log(inputRef.current); + } + return (
@@ -30,9 +36,13 @@ const SelectYear = ({ items }) => {
{items.map((item, index) => (

setSelectedYear(item)} - className={`text-base my-2 cursor-pointer text-center ${ + // onClick={() => setSelectedYear(item)} + onClick={() => { + setSelectedYear(item); + }} + className={`text-base my-2 cursor-pointer text-center transition ease-in-out duration-300 ${ selectedYear === item ? "text-[#06BACE] font-bold text-2xl" : "text-gray-300" @@ -47,7 +57,7 @@ const SelectYear = ({ items }) => {

- {selectedYear?.components} +
); @@ -58,24 +68,40 @@ export default SelectYear; SelectYear.defaultProps = { items: [ { + id: 1, + year: "1400", + }, + { + id: 2, + year: "1399", + }, + { + id: 3, + year: "1398", + }, + { + id: 4, year: "1400", - components: , }, { + id: 5, year: "1399", - components: , }, { + id: 6, year: "1398", - components: , }, { - year: "1397", - components: , + id: 7, + year: "1400", + }, + { + id: 8, + year: "1399", }, { - year: "1396", - components: , + id: 9, + year: "1398", }, ], };