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: [LINKER-142] Tab 컴포넌트 수정 #71

Merged
merged 11 commits into from
Feb 23, 2024
1 change: 1 addition & 0 deletions packages/lds/src/BottomSheet/BottomSheet.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const content = style({
borderTopRightRadius: '1.6rem',
backgroundColor: styleVar.backgroundColor,
touchAction: 'none',
overscrollBehavior: 'none',
});

export const handler = style({
Expand Down
7 changes: 6 additions & 1 deletion packages/lds/src/Layout/Layout.css.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { style } from '@vanilla-extract/css';
import { createThemeContract, style } from '@vanilla-extract/css';

export const bgColorVar = createThemeContract({
backgroundColor: null,
});

export const container = style({
maxWidth: '72rem',
minWidth: '36rem',
width: '100%',
height: '100%',
margin: '0 auto',
backgroundColor: bgColorVar.backgroundColor,
});
22 changes: 19 additions & 3 deletions packages/lds/src/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import { container } from './Layout.css';
import { assignInlineVars } from '@vanilla-extract/dynamic';

const Layout = ({ children }: { children: React.ReactNode }) => {
return <section className={container}>{children}</section>;
import { bgColorVar, container } from './Layout.css';

interface Props {
children: React.ReactNode;
bgColor?: string;
}

const Layout = ({ children, bgColor }: Props) => {
return (
<section
className={container}
style={assignInlineVars(bgColorVar, {
backgroundColor: bgColor == null ? 'inherit' : bgColor,
})}
>
{children}
</section>
);
};

export default Layout;
20 changes: 11 additions & 9 deletions packages/lds/src/List/ListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ const ListHeader = ({
{title}
</Txt>

<Txt
as="p"
typography="p3"
fontWeight="regular"
color={colors.gray700}
className={descriptipon}
>
{description}
</Txt>
{description != null && (
<Txt
as="p"
typography="p3"
fontWeight="regular"
color={colors.gray700}
className={descriptipon}
>
{description}
</Txt>
)}
</div>

<div>{rightAddon}</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/lds/src/SearchInput/SearchInput.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { colors } from '@linker/styles';
import { style } from '@vanilla-extract/css';

export const searchInputContainer = style({
background: `${colors.gray100}`,
background: `${colors.gray050}`,
width: '100%',
borderRadius: '0.4rem',
height: '4.4rem',
Expand Down
16 changes: 9 additions & 7 deletions packages/lds/src/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ const SearchInput = ({
onBlur={() => (setIsFocused ? setIsFocused(false) : () => {})}
value={watchQuery}
/>
<button
onClick={() => {
reset({ search: '' });
}}
>
<Icon name="close-gray" size={16} />
</button>
{query != null && (
<button
onClick={() => {
reset({ search: '' });
}}
>
<Icon name="close-gray" size={16} />
</button>
)}
</div>
)}
/>
Expand Down
38 changes: 21 additions & 17 deletions packages/lds/src/Tabs/Tabs.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,51 @@ import { style } from '@vanilla-extract/css';
import { TAB_HEIGHT } from '../constants';

export const tabs = style({
maxWidth: '72rem',
maxWidth: '68rem',
margin: '0 auto',
});

export const tapList = style({
export const tabList = style({
position: 'relative',
display: 'flex',
});

export const tapItem = style({
export const tabItem = style({
position: 'relative',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flex: 1,
});

export const activeTabItem = style({
selectors: {
'&:after': {
content: '',
position: 'absolute',
bottom: -2,
width: '80%',
height: '0.4rem',
backgroundColor: `${colors.gray000}`,
},
},
});

export const link = style({
opacity: 0.3,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '94px',
height: TAB_HEIGHT,
fontSize: '1.6rem',
color: 'rgba(255, 255, 255, 0.3)',
fontWeight: 'bold',
});

export const activeLink = style({
color: `${colors.gray000}`,
opacity: '1 !important',
transition: 'opacity 0.1s ease-out',
});

export const bottomLine = style({
position: 'relative',
width: '100%',
height: '4px',
height: '0.2rem',
backgroundColor: 'rgba(255, 255, 255, 0.3)',
});

export const activeLine = style({
position: 'absolute',
height: '100%',
backgroundColor: `${colors.gray000}`,
transition: 'left 0.1s ease-out',
});
19 changes: 12 additions & 7 deletions packages/lds/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use client';

import { colors } from '@linker/styles';
import { clsx } from 'clsx';
import Link from 'next/link';
import { usePathname } from 'next/navigation';

import { tabs, tapList, tapItem, link, activeLink, bottomLine, activeLine } from './Tabs.css';
import { tabs, tabList, tabItem, link, activeLink, bottomLine, activeTabItem } from './Tabs.css';
import { Txt } from '../Txt';

export interface TabInfo {
href: string;
Expand All @@ -20,21 +22,24 @@ function Tabs({ tabInfos }: TabsProps) {

return (
<nav className={tabs}>
<ul className={tapList}>
<ul className={tabList}>
{tabInfos.map((tabInfo) => (
<li className={tapItem} key={tabInfo.href}>
<li
className={clsx(tabItem, pathname === tabInfo.href && activeTabItem)}
key={tabInfo.href}
>
<Link
href={tabInfo.href}
className={clsx(link, pathname === tabInfo.href && activeLink)}
>
<span>{tabInfo.text}</span>
<Txt typography="p1" color={colors.gray000} fontWeight="bold">
{tabInfo.text}
</Txt>
</Link>
</li>
))}
</ul>
<div className={bottomLine}>
<div className={activeLine} />
</div>
<div className={bottomLine} />
</nav>
);
}
Expand Down
7 changes: 7 additions & 0 deletions services/web/src/app/my/contact/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Layout } from '@linker/lds';
import { colors } from '@linker/styles';

function ContactLayout({ children }: { children: React.ReactNode }) {
return <Layout bgColor={colors.gray000}>{children}</Layout>;
}
export default ContactLayout;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const bannerContainer = style({
alignItems: 'center',
justifyContent: 'space-between',
maxWidth: '72rem',
margin: '1.6rem auto',
background: `${colors.gradationPurple} !important`,
animation: `${keyframesExample} 0.4s linear`,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const wrapper = style({

export const header = style({
padding: '0 2rem',
marginBottom: '2.2rem',
marginBottom: '1.6rem',
});

export const scheduleList = style({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { style } from '@vanilla-extract/css';

export const button = style({
width: '100%',
height: '4rem',
backgroundColor: colors.blue050,
height: '4rem !important',
backgroundColor: `${colors.blue050} !important`,
});
27 changes: 5 additions & 22 deletions services/web/src/app/my/feed/trend/components/Trend.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { NewsDTO } from '@/types/news';
import { TagDTO } from '@/types/tag';
import { ky } from '@linker/ky';
import { List } from '@linker/lds';
import Image from 'next/image';
import { IconButton, List, Spacing } from '@linker/lds';
import Link from 'next/link';

import { getTokens } from '@utils/token/server';

import Issue from './Issue';
import MoreButton from './MoreButton';

Expand All @@ -21,17 +18,11 @@ export interface TrendDTO {
}>;
}

function getTrendNews() {
const getTrendNews = () => {
return ky.get<TrendDTO>('/v1/news/trend?size=3');
}
};

async function Trend() {
const accessToken = getTokens().accessToken;

if (accessToken == null) {
return;
}

const { recommendations } = await getTrendNews();

return (
Expand All @@ -40,17 +31,9 @@ async function Trend() {
<List.Header
title="트렌드 핫 이슈"
typograyphy="h7"
rightAddon={
<button type="button">
<Image
src="https://static.im-linker.com/right-arrow-mono.png"
alt=""
width={28}
height={28}
/>
</button>
}
rightAddon={<IconButton name="next-gray" size={24} />}
/>
<Spacing size={16} />
<Issue recommendations={recommendations} />
<MoreButton />
</Link>
Expand Down
2 changes: 1 addition & 1 deletion services/web/src/features/error/ErrorPage.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const container = style({
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
height: '90vh',
height: '80vh',
});

export const title = style({
Expand Down
2 changes: 1 addition & 1 deletion services/web/src/features/my/MyHeader/MyHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MyProfile from './MyProfile';
import MyProfileCard from './MyProfileCard';

const TAB_ITEMS = [
{ href: '/my/feed', text: '피드' },
{ href: '/my/feed', text: '피드' },
{ href: '/my/contact', text: '연락처' },
{ href: '/my/timeline', text: '타임라인' },
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const scheduleInput = style({
backgroundColor: `${colors.gray050} !important`,
});

export const titleInput = style({
borderRadius: '0 !important',
});

export const contactAddButton = style({
display: 'inline-flex',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
scheduleInput,
textarea,
textareaContainer,
titleInput,
} from './AddScheduleBottomSheet.css';
import SearchContact from './SearchContact';
import { contactCard, contactCardInfo, contactWrapper } from './SearchContact.css';
Expand Down Expand Up @@ -138,7 +139,7 @@ const AddScheduleBottomSheet = () => {
<form className={container}>
<div style={{ backgroundColor: categoryColor }} className={categoryIdentifier} />
<Input
className={typography({ type: 'h5' })}
className={clsx(typography({ type: 'h5' }), titleInput)}
placeholder="어떤 일정인가요?"
errorMessage={errors.title?.message}
{...register('title', {
Expand Down
Loading