Skip to content

Commit

Permalink
fix: space item responsive layout
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Mar 27, 2024
1 parent 58f1004 commit b9c3821
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
36 changes: 13 additions & 23 deletions next/components/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,19 @@ import styled from "styled-components";
import { useCallback, useEffect, useState } from "react";

import InternalLink from "./internalLink";
import { no_scroll_bar } from "../styles/globalCss";
import { h3_36_bold, p_16_semibold } from "../styles/textStyles";
import { useWindowSize } from "../frontedUtils/hooks";
import { setCookie } from "frontedUtils/cookie";
import { loginAddressSelector } from "store/reducers/accountSlice";
import SpaceListItem from "./spaceListItem";
import { useDispatch, useSelector } from "react-redux";
import { fetchJoinedSpace } from "store/reducers/accountSlice";
import { cn } from "@osn/common-ui";

const Title = styled.div`
${h3_36_bold};
`;

const ItemsWrapper = styled.div`
display: flex;
gap: 20px;
justify-content: start;
overflow: visible;
min-height: 227px;
${no_scroll_bar};
@media screen and (max-width: 1144px) {
margin: 0 -32px;
padding: 0 32px;
}
@media screen and (max-width: 800px) {
margin: 0 -20px;
padding: 0 20px;
}
flex-wrap: wrap;
`;

const TitleWrapper = styled.div`
display: flex;
align-items: center;
Expand Down Expand Up @@ -98,15 +78,25 @@ export default function Space({ spaces, showAllSpace }) {
</SpaceButton>
</ButtonWrapper>
</TitleWrapper>
<ItemsWrapper>

<div
className={cn(
"grid gap-5",
"grid-cols-5",
"max-xl:grid-cols-4",
"max-lg:grid-cols-3",
"max-md:grid-cols-2",
"max-sm:grid-cols-1",
)}
>
{(show ? sortedSpaces : sortedSpaces.slice(0, showCount)).map(
([name, space], index) => (
<InternalLink href={`/space/${name}`} key={index}>
<SpaceListItem name={name} space={space} />
</InternalLink>
),
)}
</ItemsWrapper>
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion next/components/spaceListItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Wrapper = styled.div`
background: var(--fillBgPrimary);
padding: 24px;
cursor: pointer;
width: 200px;
min-width: 200px;
:hover {
border-color: var(--strokeActionDefault);
Expand Down

0 comments on commit b9c3821

Please sign in to comment.