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: Add @types for styled-components #109

Merged
merged 2 commits into from
May 4, 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
9 changes: 4 additions & 5 deletions components/BottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
faUsersRectangle,
} from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Link from "next/link";
import Link, { LinkProps } from "next/link";
import { usePathname, useSearchParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useSetRecoilState } from "recoil";
Expand Down Expand Up @@ -90,7 +90,7 @@ function NavButton({ text, url, activeIcon, defaultIcon, active, idx }: INavButt
<NavLink
onClick={() => handleMove()}
href={url}
active={active.toString()}
active={active.toString() as "true" | "false"}
replace={!text}
className={`bottom_nav${idx}`}
>
Expand Down Expand Up @@ -146,16 +146,15 @@ const Nav = styled.nav`
margin: 0 auto;
`;

const NavLink = styled<{ active: "true" | "false" }>(Link)`
const NavLink = styled(Link)<{ active: "true" | "false" } & LinkProps>`
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 16px;
margin-top: 4px;
color: ${({ active }: { active: "true" | "false" }) =>
active === "true" ? "var(--gray-2)" : "var(--gray-3)"};
color: ${({ active }) => (active === "true" ? "var(--gray-2)" : "var(--gray-3)")};
`;

const NavText = styled.div`
Expand Down
4 changes: 3 additions & 1 deletion components/atoms/CircleLogImage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Image from "next/image";
import styled from "styled-components";

interface ICircleLogImage {
logoName: string;
imageUrl: string;
}

export default function CircleLogoImage({ logoName, imageUrl }: ICircleLogImage) {
return (
<CircleLogoWrapper logoName={logoName}>
<CircleLogoWrapper>
<Image src={imageUrl} width={72} height={72} alt={logoName} />
</CircleLogoWrapper>
);
Expand Down
7 changes: 4 additions & 3 deletions components/atoms/IconLinkTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Link from "next/link";
import styled from "styled-components";

import { Size } from "../../types/components/assetTypes";

export interface IIconLinkTile {
text: string;
icon: React.ReactNode;
Expand Down Expand Up @@ -47,9 +48,9 @@ const IconContainer = styled.div`
margin-bottom: 8px; /* mb-3์— ํ•ด๋‹นํ•˜๋Š” ๋งˆ์ง„ ๊ฐ’ */
`;

const Text = styled.span`
const Text = styled.span<{ size: Size }>`
white-space: nowrap;
font-size: ${(props) =>
props.size === "lg" ? "14px" : "10px"}; /* text-xs์™€ text-sm์— ํ•ด๋‹นํ•˜๋Š” ํฐํŠธ ํฌ๊ธฐ */
font-size: ${({ size }) =>
size === "lg" ? "14px" : "10px"}; /* text-xs์™€ text-sm์— ํ•ด๋‹นํ•˜๋Š” ํฐํŠธ ํฌ๊ธฐ */
font-weight: normal;
`;
2 changes: 1 addition & 1 deletion components/atoms/RulletPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const ItemsContainer = styled(motion.div)`
z-index: 10;
`;

const Item = styled.div`
const Item = styled.div<{ isActive: boolean }>`
position: relative;
z-index: 10;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion components/atoms/buttons/ShadowCircleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ShadowCircleButton({ buttonProps, onClick }: IShadowCirc
);
}

const OuterCircle = styled.div`
const OuterCircle = styled.div<{ shadow: string }>`
position: relative;
z-index: 10;
padding: 8px;
Expand Down
4 changes: 2 additions & 2 deletions components/molecules/badge/AttendanceBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default function AttendanceBadge({ type, time }: IAttendanceBadge) {
);
}

const BadgeContainer = styled.div`
const BadgeContainer = styled.div<{ time?: string }>`
display: flex;
flex-direction: column;
align-items: center;
padding-top: ${(props) => (props.time ? "8px" : "0")};
padding-top: ${({ time }) => (time ? "8px" : "0")};
`;

const TimeText = styled.span`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const UserTimeBoardContainer = styled.div`
width: 344px;
`;

const BoardContainer = styled.div`
const BoardContainer = styled.div<{ participants: ITimeBoardParticipant[] }>`
min-height: 160px;
display: flex;
flex-direction: column;
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@tanstack/eslint-plugin-query": "^5.28.11",
"@types/node": "20.11.17",
"@types/react": "18.2.55",
"@types/styled-components": "^5.1.34",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"chromatic": "^11.3.0",
Expand Down
Loading