Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply design qa #50

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/app/(main)/report/dividend/_components/dividend-row.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { SingleYearlyDividendResponse, StockResponse } from "@/api/generated/endpoint.schemas";
import Image from "next/image";
import React from "react";
import TickerDefault from "@/components/icons/ticker-default";

export interface Dividend extends StockResponse {
share?: number;
Expand All @@ -10,13 +11,17 @@ export const DividendRow = React.memo(({ dividend }: { dividend: SingleYearlyDiv
return (
<div className="flex h-full w-full flex-1 items-center gap-4">
<div className="flex size-10 shrink-0 items-center justify-center rounded-full border border-grey-100">
<Image
className="flex size-10 object-contain p-1"
width={40}
height={40}
src={dividend.logoUrl ?? "/next.svg"}
alt={dividend.ticker}
/>
{dividend.logoUrl === null ? (
<TickerDefault className="h-10 min-w-10 max-w-10" />
) : (
<Image
className="flex size-10 object-contain p-1"
width={40}
height={40}
src={dividend.logoUrl}
alt={dividend.ticker}
/>
)}
</div>
<div className="items-between flex w-full flex-col justify-center gap-1">
<div className="flex items-center justify-between">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { formatDateStringToMonthDay } from "@/utils/date";
import Image from "next/image";
import { useRouter } from "next/navigation";
import React, { useCallback } from "react";
import TickerDefault from "@/components/icons/ticker-default";

interface InsightsStock {
dividendYield?: number;
Expand Down Expand Up @@ -49,14 +50,17 @@ export const SectorInsightsItem = React.memo(({ title, data, type }: SectorInsig
}}
>
<div className="flex flex-col gap-4">
<Image
src={stock.logoUrl ?? "/next.svg"}
alt={stock.ticker}
className="h-8 w-8 rounded-full border border-grey-100"
width={32}
height={32}
/>

{stock.logoUrl === null ? (
<TickerDefault className="h-8 min-w-8 max-w-8" />
) : (
<Image
src={stock.logoUrl}
alt={stock.ticker}
className="h-8 w-8 rounded-full border border-grey-100"
width={32}
height={32}
/>
)}
<div>
<h5 className="text-h5 text-grey-900">{stock.ticker}</h5>
<p className="mt-0.5 truncate text-body2 text-main-900">
Expand Down
30 changes: 0 additions & 30 deletions src/app/(main)/report/sector-list/_components/sector-row.tsx

This file was deleted.

11 changes: 9 additions & 2 deletions src/app/(main)/ticker/_components/ticker-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ const TickerContent = React.memo(() => {
if (selectedStock) {
resetData();

addStock({ ...selectedStock, count: tickerCount });
const existingStock = stocks.find((stock) => stock.stockId === selectedStock.stockId);

if (existingStock !== undefined) {
// 주식이 이미 존재하는 경우 업데이트
editStock({ ...selectedStock, count: existingStock.count + tickerCount });
} else {
addStock({ ...selectedStock, count: tickerCount });
}
isDrawerOpenChange(false);
}
}, [addStock, isDialogOpenChange, isDrawerOpenChange, resetData, selectedStock, stocks.length, tickerCount]);
}, [addStock, editStock, isDialogOpenChange, isDrawerOpenChange, resetData, selectedStock, stocks, tickerCount]);

const handleInputClear = React.useCallback((type: DrawerType) => {
if (type === "name") {
Expand Down
21 changes: 13 additions & 8 deletions src/app/(main)/ticker/_components/ticker-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Stock } from "@/state/stores/stocks-store";
import React from "react";
import Image from "next/image";
import TickerDefault from "@/components/icons/ticker-default";

interface TickerProps {
data: Stock[];
Expand Down Expand Up @@ -41,14 +42,18 @@ const TickerList = React.memo(({ data, tickerName, hasShares, onClick }: TickerP
<div className={`flex w-full flex-1 flex-col items-start ${hasShares ? "gap-6 pt-6" : "gap-5 pt-8"} px-4 pb-1`}>
{data.map((item, index) => (
<div key={index} className="flex w-full justify-between" onClick={() => onClick(item)}>
<div className="flex items-center">
<Image
src={item.logoUrl ?? "/next.svg"}
alt={"stock logo"}
width={40}
height={40}
className="mr-4 flex h-10 min-w-10 max-w-10 items-center justify-center rounded-full border border-grey-100 bg-grey-50 object-contain p-1"
/>
<div className="flex items-center ">
{item.logoUrl === null ? (
<TickerDefault className="mr-4 h-10 min-w-10 max-w-10" />
) : (
<Image
src={item.logoUrl ?? "/next.svg"}
alt={"stock logo"}
width={40}
height={40}
className="mr-4 h-10 min-w-10 max-w-10 rounded-full border border-grey-100 bg-grey-50 object-contain p-1"
/>
)}
<div className="flex flex-col">
<span className="mb-1 line-clamp-1 break-all text-left text-h5 text-grey-900">
{getHighlightText(item.ticker)}
Expand Down
15 changes: 15 additions & 0 deletions src/components/icons/ticker-default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";

export interface TickerDefaultProps extends React.SVGProps<SVGSVGElement> {}

const TickerDefault = React.memo(({ ...props }: TickerDefaultProps) => {
return (
<svg {...props} xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
<rect width="40" height="40" rx="20" fill="#EFF1FC" />
<path d="M9.04102 25.2097L14.8493 19.4016L19.942 24.4944L29.719 14.7174" stroke="#BDC7FC" strokeWidth="1.5" />
<path d="M29.7717 20.1609V14.7192H24.624" stroke="#BDC7FC" strokeWidth="1.5" />
</svg>
);
});

export default TickerDefault;