Skip to content

Commit

Permalink
[#207]
Browse files Browse the repository at this point in the history
Fix the ul li key warning as well
  • Loading branch information
tommyttf committed Nov 6, 2023
1 parent 95aa53f commit cfdd056
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 42 deletions.
26 changes: 14 additions & 12 deletions client/components/customized-ui/drop-down-menu/user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
import { useToast } from "@/components/ui/use-toast"
import BaseAvatar from "@/components/customized-ui/avatars/base"





const UserDropDownMenu = () => {
const user = useUserStore((state) => state)
const userState = useUserStore((state) => state)
Expand Down Expand Up @@ -55,18 +59,16 @@ const UserDropDownMenu = () => {
<span>{user.username}</span>
</DropdownMenuTrigger>
<DropdownMenuContent>
{nav.map((n) => {
return (
<DropdownMenuItem>
<Link
href={n.href}
className="flex w-full items-center justify-center space-x-2"
>
{n.title}
</Link>
</DropdownMenuItem>
)
})}
{nav.map((n) => (
<DropdownMenuItem key={n.href}>
<Link
href={n.href}
className="flex w-full items-center justify-center space-x-2"
>
{n.title}
</Link>
</DropdownMenuItem>
))}

<DropdownMenuItem
className="flex cursor-pointer justify-center"
Expand Down
17 changes: 10 additions & 7 deletions client/components/customized-ui/form/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ import {
} from "@/components/ui/select"
import { IFormTextInputProps } from "@/components/customized-ui/form/input"





interface IFormSelectProps extends IFormTextInputProps {
options: { value: string; title: string }[]
defaultValue?: string
}

const FormSelect: React.FunctionComponent<IFormSelectProps> = ({
control,
name,
Expand Down Expand Up @@ -52,13 +57,11 @@ const FormSelect: React.FunctionComponent<IFormSelectProps> = ({
<ScrollArea>
{options &&
options.length > 0 &&
options.map((option) => {
return (
<SelectItem value={option.value}>
{option.title}
</SelectItem>
)
})}
options.map((option) => (
<SelectItem value={option.value} key={option.value}>
{option.title}
</SelectItem>
))}
</ScrollArea>
</SelectContent>
</Select>
Expand Down
16 changes: 11 additions & 5 deletions client/components/customized-ui/selects/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ import {
SelectValue,
} from "@/components/ui/select"





export interface ISelectOption {
value: string
title: string
}

interface IBaseSelectProps {
triggerClassName?: string
placeholder?: string
Expand All @@ -22,6 +27,7 @@ interface IBaseSelectProps {
defaultValue?: string
value?: string
}

const BaseSelect: React.FunctionComponent<IBaseSelectProps> = ({
triggerClassName,
placeholder,
Expand All @@ -38,11 +44,11 @@ const BaseSelect: React.FunctionComponent<IBaseSelectProps> = ({
<SelectContent className="max-h-[300px]">
<ScrollArea>
{options &&
options.map((option) => {
return (
<SelectItem value={option.value}>{option.title}</SelectItem>
)
})}
options.map((option) => (
<SelectItem value={option.value} key={option.value}>
{option.title}
</SelectItem>
))}
</ScrollArea>
</SelectContent>
</Select>
Expand Down
28 changes: 14 additions & 14 deletions client/components/ui/toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ import {
} from "@/components/ui/toast"
import { useToast } from "@/components/ui/use-toast"





export function Toaster() {
const { toasts } = useToast()

return (
<ToastProvider>
{toasts.map(function ({ id, title, description, action, ...props }) {
return (
<Toast key={id} {...props}>
<div className="grid gap-1">
{title && <ToastTitle>{title}</ToastTitle>}
{description && (
<ToastDescription>{description}</ToastDescription>
)}
</div>
{action}
<ToastClose />
</Toast>
)
})}
{toasts.map(({ id, title, description, action, ...props }) => (
<Toast key={id} {...props}>
<div className="grid gap-1">
{title && <ToastTitle>{title}</ToastTitle>}
{description && <ToastDescription>{description}</ToastDescription>}
</div>
{action}
<ToastClose />
</Toast>
))}
<ToastViewport />
</ToastProvider>
)
Expand Down
9 changes: 7 additions & 2 deletions client/modules/contributors/components/contributor-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { IContributor } from "@/modules/contributors/types/contributor"
import { Card, CardTitle } from "@/components/ui/card"
import { Icons } from "@/components/icons"





interface IContributorCard extends IContributor {}

const ContributorCard: React.FunctionComponent<IContributorCard> = ({
contributedArea,
links,
Expand Down Expand Up @@ -42,8 +47,8 @@ const ContributorCard: React.FunctionComponent<IContributorCard> = ({
</div>

<div className="flex flex-row gap-2">
{contributedArea.map((data, index) => (
<ContributionAreaBadge area={data} key={index} />
{contributedArea.map((data) => (
<ContributionAreaBadge area={data} key={data} />
))}
</div>
</Card>
Expand Down
8 changes: 6 additions & 2 deletions client/modules/contributors/template.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import ContributorCard from "@/modules/contributors/components/contributor-card"
import contributors from "@/modules/contributors/data/contributors"





const ContributorsPageTemplate = () => {
return (
<>
<div className="grid grid-cols-1 gap-4 p-2 md:grid-cols-3">
{contributors.map((contributor, index) => (
{contributors.map((contributor) => (
<ContributorCard
contributedArea={contributor.contributedArea}
links={contributor.links}
name={contributor.name}
key={index}
key={contributor.name}
/>
))}
</div>
Expand Down

0 comments on commit cfdd056

Please sign in to comment.