Skip to content

Commit

Permalink
Merge pull request Nutlope#2 from chuanyu0201/fix/delete-reduplicated…
Browse files Browse the repository at this point in the history
…-code

fix: remove redundant code
  • Loading branch information
Nutlope authored Jan 22, 2023
2 parents b722c44 + 52cb3be commit c9d6f71
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
.env

# idea
.idea
10 changes: 5 additions & 5 deletions components/DropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ function classNames(...classes: string[]) {
return classes.filter(Boolean).join(" ");
}

type vibeType = "Professional" | "Casual" | "Funny";
export type VibeType = "Professional" | "Casual" | "Funny";

interface DropDownProps {
vibe: "Professional" | "Casual" | "Funny";
setVibe: (vibe: vibeType) => void;
vibe: VibeType
setVibe: (vibe: VibeType) => void;
}

let vibes: vibeType[] = ["Professional", "Casual", "Funny"];
let vibes: VibeType[] = ["Professional", "Casual", "Funny"];

export default function DropDown({ vibe, setVibe }: DropDownProps) {
return (
Expand Down Expand Up @@ -51,7 +51,7 @@ export default function DropDown({ vibe, setVibe }: DropDownProps) {
>
<div className="">
{vibes.map((vibeItem) => (
<Menu.Item>
<Menu.Item key={vibeItem}>
{({ active }) => (
<button
onClick={() => setVibe(vibeItem)}
Expand Down
4 changes: 2 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Head from "next/head";
import Image from "next/image";
import { useState } from "react";
import { Toaster, toast } from "react-hot-toast";
import DropDown from "../components/DropDown";
import DropDown, { VibeType } from "../components/DropDown";
import Footer from "../components/Footer";
import Github from "../components/GitHub";
import Header from "../components/Header";
Expand All @@ -14,7 +14,7 @@ import ResizablePanel from "../components/ResizablePanel";
const Home: NextPage = () => {
const [loading, setLoading] = useState(false);
const [bio, setBio] = useState("");
const [vibe, setVibe] = useState<"Professional" | "Casual" | "Funny">(
const [vibe, setVibe] = useState<VibeType>(
"Professional"
);
const [generatedBios, setGeneratedBios] = useState<String>("");
Expand Down

0 comments on commit c9d6f71

Please sign in to comment.