Skip to content

Commit

Permalink
feat(ui): FriendsList 컴포넌트 제작 (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 authored Jul 27, 2023
1 parent 7a4f4b7 commit 8773833
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/atoms/FriendsList/FriendsList.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Meta, StoryObj } from "@storybook/react";
import { FriendsList } from ".";

const meta: Meta<typeof FriendsList> = {
title: 'Atom/FriendsList',
component: FriendsList,
tags: ['autodocs'],
};

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

export const visibleFriendsList: Story = {
args: {
name: '김수빈',
nickName: 'beenie',
avatarImgUrl: 'kitty',
},
};

export const invisibleFriendsList: Story = {
args: {
variant: 'invisible',
name: '김수빈',
nickName: 'beenie',
avatarImgUrl: 'kitty',
},
};
57 changes: 57 additions & 0 deletions src/components/atoms/FriendsList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import styled from "@emotion/styled";
import { theme } from "@styles/theme";

import { Text } from "../Text";
import { Avatar } from "../Avatar";

import openEyeIconImgUrl from "../../../assets/icons/openEye.svg";
import closeEyeIconImgUrl from "../../../assets/icons/closeEye.svg";
import orderingIconImgUrl from "../../../assets/icons/ordering.svg";

type FriendsListVariant = 'visible' | 'invisible';

interface FriendsListProps {
variant?: FriendsListVariant;
name: string;
nickName: string;
avatarImgUrl: "kitty" | "monkey";
onClick?: () => void;
}

export const FriendsList = ({ variant = 'visible', name, nickName, avatarImgUrl, onClick }: FriendsListProps) => {
return (
<Wrapper variant={variant}>
<Avatar variant="small" color="purple" imageUrl={`${avatarImgUrl}`} isVisible={`${variant}`} />
<NameWrapper>
{variant === 'visible' ? <Text children={name} typo='Subhead_16' /> : <Text children={name} typo='Subhead_16' color='gray_400' />}
<Text children={'@' + nickName} typo='Caption_12M' color='gray_300' />
</NameWrapper>
<IconWrapper>
{variant === 'visible' ? <img src={openEyeIconImgUrl} /> : <img src={closeEyeIconImgUrl} />}
<img src={orderingIconImgUrl} onClick={onClick} />
</IconWrapper>
</Wrapper>
);
};

const Wrapper = styled.div<{ variant: FriendsListVariant }>`
width: 312px;
height: 48px;
background-color: ${theme.palette.background};
display: flex;
`;

const NameWrapper = styled.div`
width: 132px;
margin-left: 16px;
margin-right: 52px;
`;

const IconWrapper = styled.div`
display: flex;
width: 64px;
height: 24px;
margin: auto 0;
gap: 16px;
justify-content: space-between;
`;

0 comments on commit 8773833

Please sign in to comment.