Skip to content
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"react-calendar": "^5.0.0",
"react-dom": "^18.2.0",
"react-feather": "^2.0.10",
"react-hook-form": "^7.54.2",
"react-node-to-string": "^0.1.2",
"react-select": "^5.10.0",
"zustand": "^4.4.3"
},
"peerDependencies": {
Expand Down
56 changes: 53 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions src/components/atoms/NewSelect/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* eslint-disable react-hooks/rules-of-hooks */

import { NewSelect } from "@/components/atoms/NewSelect";

import type { Meta, StoryObj } from "@storybook/react";

const meta: Meta<typeof NewSelect> = {
title: "molecules/NewSelect",
component: NewSelect,
argTypes: {},
decorators: [(Story) => <Story />],
tags: ["autodocs"],
};

export default meta;
type Story = StoryObj<typeof NewSelect>;

export const Default: Story = {
render: () => {
return (
<>
<div
style={{
height: "500px",
}}
>
<NewSelect
options={[
{ value: "chocolate", label: "Chocolate" },
{ value: "strawberry", label: "Strawberry" },
{ value: "vanilla", label: "Vanilla" },
]}
/>
</div>
</>
);
},
};
21 changes: 21 additions & 0 deletions src/components/atoms/NewSelect/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { forwardRef } from "react";
import Select, { Props } from "react-select";
import makeAnimated from "react-select/animated";

export type NewSelectProps = Props & {
isAnimation?: boolean;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const NewSelect = forwardRef<any, NewSelectProps>(
({ isAnimation = true, ...props }, ref) => {
const animatedComponents = makeAnimated();

return (
<Select
ref={ref}
components={isAnimation ? animatedComponents : undefined}
{...props}
/>
);
},
);
14 changes: 10 additions & 4 deletions src/components/molecules/Table/HoverTableCell.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { PropsWithChildren, useEffect, useRef, useState } from "react";
import {
CSSProperties,
PropsWithChildren,
useEffect,
useRef,
useState,
} from "react";
import styles from "./HoverTableCell.module.scss";
import { useToast } from "@/index";
import nodeToString from "react-node-to-string";
import { Copy } from "react-feather";
import { CopyMessageType } from "@/components/molecules/Table/TableCell";

export interface HoverTableCellProps extends PropsWithChildren {
maxWidth?: number;
maxWidth?: CSSProperties["maxWidth"];
copyMessage?: CopyMessageType;
}

Expand All @@ -31,7 +37,7 @@ export const HoverTableCell = ({

const handleCopy = async (
text: string,
toastMessage?: { success: string; fail?: string }
toastMessage?: { success: string; fail?: string },
) => {
await navigator.clipboard
.writeText(text)
Expand All @@ -47,7 +53,7 @@ export const HoverTableCell = ({
type: "fail",
children: toastMessage?.fail || "복사에 실패했습니다.",
holdTime: 3000,
})
}),
);
};

Expand Down
11 changes: 1 addition & 10 deletions src/components/molecules/Table/TableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ export const TableCell = ({
const classes = `${className} ${maxWidth ? "max-w-" + maxWidth : ""} ${
hoveredColumn === columnIndex ? styles.hovered : ""
}`;
console.log(
COLUMN_INDEX.CAPYABLE,
columnIndex,
COLUMN_INDEX.CAPYABLE === columnIndex
);

return (
<td className={`${cleanClassName(classes)}`}>
{maxWidth || copyMessage ? (
Expand All @@ -49,8 +45,3 @@ export const TableCell = ({
</td>
);
};
const COLUMN_INDEX = {
CAPYABLE: 2,
LONG_TEXT: 6,
LONG_TEXT_COPYABLE: 7,
};