Skip to content

Commit

Permalink
Refactor: 변경된 mediaquries에 맞춰서 Positions, Stack 컴포넌트 수정 (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
hankim0904 authored Mar 23, 2024
1 parent 96a0c82 commit 47e44d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions co-kkiri/src/components/commons/Positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import styled from "styled-components";
import PositionChip from "./Chips/PositionChip";
import DefaultChip from "./Chips/DefaultChip";
import useResponsiveSidebar from "@/hooks/useResponsiveSideBar";
import { breakpoints } from "@/styles/tokens";
import { ICONS } from "@/constants/icons";
import { POSITION_CHIP_LIMIT } from "@/constants/cardChipLimits";

Expand All @@ -23,16 +22,15 @@ export default function Positions({ positions, variant = "profile", page = "home

useLayoutEffect(() => {
if (variant === "card") {
const { tablet, desktop } = breakpoints;
const pageLimits = POSITION_CHIP_LIMIT[page];

let limit = pageLimits.mobile;

if (windowWidth >= tablet) {
if (windowWidth >= 768) {
limit = pageLimits.tablet;
}

if (windowWidth >= desktop) {
if (windowWidth >= 1200) {
limit = isSidebarOpenNarrow ? pageLimits.desktopNarrow : pageLimits.desktopWide;
}

Expand Down
3 changes: 1 addition & 2 deletions co-kkiri/src/components/commons/Stacks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ export default function Stacks({ stacks, variant = "profile" }: StacksProps) {

useLayoutEffect(() => {
if (variant === "card") {
const { desktop } = breakpoints;
const { mobile, desktopNarrow, desktopWide } = STACK_CHIP_LIMIT;

let limit = mobile;

if (windowWidth >= desktop) {
if (windowWidth >= 1200) {
limit = isSidebarOpenNarrow ? desktopNarrow : desktopWide;
}
setDisplayPositions(stacks.slice(0, limit));
Expand Down

0 comments on commit 47e44d5

Please sign in to comment.