Skip to content

Commit

Permalink
style: fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
chloeelim committed Sep 23, 2024
1 parent 24bf7ec commit 7963733
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 36 deletions.
20 changes: 2 additions & 18 deletions frontend/app/home.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
import Chip from "@/components/display/chip";
import NewsArticle from "@/components/news/news-article";
import { useUserStore } from "@/store/user/user-store-provider";
import {
categoriesToDisplayName,
categoriesToIconsMap,
Category,
} from "@/types/categories";
import {
ArrowUpLeft,
ArrowUpLeftIcon,
ArrowUpRightIcon,
Cat,
ExternalLinkIcon,
} from "lucide-react";
import Image from "next/image";

/* This component should only be rendered to authenticated users */
const Home = () => {
const user = useUserStore((store) => store.user);
return (
<div className="flex flex-col w-full py-8 mx-8 md:mx-16 xl:mx-32">
<div className="mb-8">
<div className="mb-12">
<span className="text-sm text-muted-foreground">
{new Date().toDateString()}
</span>
<h1 className="text-2xl lg:text-3xl 2xl:text-4xl font-semibold">
<h1 className="text-2xl lg:text-3xl 2xl:text-4xl font-bold">
What happened this week
</h1>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/display/chip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cva, VariantProps } from "class-variance-authority";
import { LucideIcon } from "lucide-react";

import { Box } from "@/components/ui/box";
import { cn } from "@/lib/utils";
import { LucideIcon } from "lucide-react";

const chipVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-xs font-medium transition-colors disabled:pointer-events-none disabled:opacity-50",
Expand Down Expand Up @@ -36,7 +36,7 @@ interface ChipProps extends VariantProps<typeof chipVariants> {
const Chip = ({ label, variant, size, className, Icon }: ChipProps) => {
return (
<Box className={cn(chipVariants({ variant, size }), className)}>
{Icon && <Icon size={16} strokeWidth={1.8} className="mr-2" />}
{Icon && <Icon className="mr-2" size={16} strokeWidth={1.8} />}
{label}
</Box>
);
Expand Down
12 changes: 5 additions & 7 deletions frontend/components/navigation/sidebar/sidebar-other-topics.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ComponentProps } from "react";

import {
categoriesToDisplayName,
categoriesToIconsMap,
Expand Down Expand Up @@ -29,14 +27,14 @@ const SidebarOtherTopics = () => {
Other topics
</h1>
<div className="flex flex-col">
{otherTopics.map((topicItem) => {
const categoryLabel = categoriesToDisplayName[topicItem];
const categoryIcon = categoriesToIconsMap[topicItem];
{otherTopics.map((category) => {
const categoryLabel = categoriesToDisplayName[category];
const categoryIcon = categoriesToIconsMap[category];
return (
<SidebarItemWithIcon
key={categoryLabel}
label={categoryLabel}
Icon={categoryIcon}
key={category}
label={categoryLabel}
/>
);
})}
Expand Down
18 changes: 10 additions & 8 deletions frontend/components/news/news-article.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Image from "next/image";
import { ArrowUpRightIcon } from "lucide-react";

import Chip from "@/components/display/chip";
import {
categoriesToDisplayName,
categoriesToIconsMap,
Category,
} from "@/types/categories";
import { ArrowUpRightIcon } from "lucide-react";
import Chip from "../display/chip";
import Image from "next/image";

const sampleArticleCategories = [
Category.Economics,
Expand All @@ -20,7 +21,7 @@ const NewsArticle = () => {
<div className="flex flex-col w-full lg:w-7/12">
<div className="flex w-full justify-between text-sm text-offblack">
<span>
<ArrowUpRightIcon size={16} className="inline-flex" /> CNA, Guardian
<ArrowUpRightIcon className="inline-flex" size={16} /> CNA, Guardian
</span>
<span>21 Sep 2024</span>
</div>
Expand All @@ -34,24 +35,25 @@ const NewsArticle = () => {
<div className="flex flex-wrap gap-x-2 gap-y-2 mt-6">
{sampleArticleCategories.map((category) => (
<Chip
label={categoriesToDisplayName[category]}
Icon={categoriesToIconsMap[category]}
key={category}
label={categoriesToDisplayName[category]}
variant="greygreen"
/>
))}
</div>
</div>
<div className="flex w-full lg:w-5/12 mb-6 items-center">
<Image
width={273}
alt=""
height={154}
unoptimized
src="https://onecms-res.cloudinary.com/image/upload/s--893X2dru--/c_fill,g_auto,h_468,w_830/fl_relative,g_south_east,l_mediacorp:cna:watermark:2021-08:cna,w_0.1/f_auto,q_auto/v1/mediacorp/cna/image/2024/09/21/RAY_3553.JPG?itok=aFJ8bcqO"
alt=""
style={{
width: "100%",
height: "fit-content",
}}
unoptimized
width={273}
/>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion frontend/types/categories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Building2,
Car,
DollarSign,
Film,
HeartHandshake,
Expand Down

0 comments on commit 7963733

Please sign in to comment.