Tascurator / tascurator-frontend

0 stars 0 forks source link

feat: create UI components steps indicator #57

Closed Akikaze1119 closed 2 weeks ago

Akikaze1119 commented 1 month ago

Overview

The task is to create a shared UI component for steps indicator.

Changes

Created steps indicator component based on figma

Screenshots or videos

▼Figma Screenshot 2024-04-09 at 4 49 07 PM

▼Code https://github.com/Tascurator/tascurator-frontend/assets/132441773/7ce8df02-e98a-4420-8c11-84dc2ec22c69

Notes

About bar style

I used hard code for setting the height of the horizontal bar.

About the name

Since 'stepper' seems to be more common, both the file name and the component name are set to 'stepper'. Reference

About the confirmation code

The following code can be used for review.

'use client';
import { useState } from 'react';

import { Stepper } from '@/components/ui/stepper';
import { Button } from '@/components/ui/button';

const INITIAL_STEP = 1;
const MAX_STEPS = 4;

export default function Home() {
  const [currentStep, setCurrentStep] = useState(INITIAL_STEP);

  return (
    <>
      <main className="flex min-h-screen flex-col items-center p-6">
        <Stepper currentStep={currentStep} maxSteps={MAX_STEPS} />

        <div className="flex mt-10 gap-4">
          <Button
            size="sm"
            onClick={() => setCurrentStep((prev) => prev - 1)}
            disabled={currentStep === INITIAL_STEP}
          >
            Previous
          </Button>
          <Button
            size="sm"
            onClick={() => setCurrentStep((prev) => prev + 1)}
            disabled={currentStep === MAX_STEPS}
          >
            Next
          </Button>
        </div>
      </main>
    </>
  );
}

Assignee Checklist:

Reviewer Checklist:

Akikaze1119 commented 2 weeks ago

@KaiKoide Thank you for your review! I modified codes.