Skip to content

Commit

Permalink
feat: [LINKER-46] 헤더 구조변경 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
danivelop authored Jan 2, 2024
1 parent 73fda43 commit 0153f55
Show file tree
Hide file tree
Showing 24 changed files with 117 additions and 80 deletions.
12 changes: 7 additions & 5 deletions packages/lds/src/Tabs/Tabs.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ export const tabs = style({
});

export const tapList = style({
position: 'relative',
display: 'flex',
justifyContent: 'space-between',
});

export const tapItem = style({
width: '94px',
height: '48px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flex: 1,
});

export const link = style({
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%',
width: '94px',
height: '48px',
fontSize: '1.6rem',
color: 'rgba(255, 255, 255, 0.3)',
fontWeight: 'bold',
Expand Down
8 changes: 3 additions & 5 deletions packages/lds/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ function Tabs({ tabInfos }: TabsProps) {
const { textSpan } = matchedRoute

if (textSpan) {
const { width, left } = textSpan.getBoundingClientRect()

setActiveTabStyle({
width: `${width}px`,
left: `${left}px`,
width: `${textSpan.offsetWidth}px`,
left: `${textSpan.offsetLeft}px`,
})
}
}
Expand All @@ -53,7 +51,7 @@ function Tabs({ tabInfos }: TabsProps) {
<li className={tapItem} key={tabInfo.href}>
<Link
href={tabInfo.href}
className={clsx({ [link]: true, [activeLink]: pathname === tabInfo.href })}
className={clsx(link, pathname === tabInfo.href && activeLink)}
>
<span ref={ref => tabInfo.textSpan = ref}>{tabInfo.text}</span>
</Link>
Expand Down
8 changes: 8 additions & 0 deletions services/web/src/app/friend/layout.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { style } from '@vanilla-extract/css';

export const section = style({
maxWidth: '720px',
padding: '0 16px',
margin: '0 auto',
boxSizing: 'content-box',
});
10 changes: 7 additions & 3 deletions services/web/src/app/friend/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { FriendHeaderContent } from '@/features/HeaderContent';
import { FriendHeader } from '@features/Header';

import { section } from './layout.css'

function FriendLayout({ children }: { children: React.ReactNode }) {
return (
<>
<FriendHeaderContent />
{children}
<FriendHeader />
<section className={section}>
{children}
</section>
</>
)
}
Expand Down
8 changes: 8 additions & 0 deletions services/web/src/app/me/layout.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { style } from '@vanilla-extract/css';

export const section = style({
maxWidth: '720px',
padding: '0 16px',
margin: '0 auto',
boxSizing: 'content-box',
});
18 changes: 9 additions & 9 deletions services/web/src/app/me/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { MeHeaderContent } from '@/features/HeaderContent';
import { Logo } from '@/features/Logo'
import { MyHeader } from '@features/Header';

import { section } from './layout.css'

function MeLayout({ children }: { children: React.ReactNode }) {
return (
<>
<header>
<Logo />
</header>
<MeHeaderContent />
{children}
<MyHeader />
<section className={section}>
{children}
</section>
</>
)
);
}

export default MeLayout
export default MeLayout;
19 changes: 19 additions & 0 deletions services/web/src/features/Header/FriendHeader.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { style } from '@vanilla-extract/css';

export const minimizeStyle = style({});

export const header = style({
background: 'linear-gradient(290.64deg, #FF8058 6.56%, #FB7A93 100.28%)',

selectors: {
[`&.${minimizeStyle}`]: {
position: 'sticky',
top: 0,
},
},
});

export const headerContent = style({
maxWidth: '720px',
margin: '0 auto',
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { clsx } from 'clsx';
import { useParams } from 'next/navigation';
import { useRef } from 'react';

import { contentWrapper, fixedHeader } from './FriendHeaderContent.css';
import { minimizeStyle, header, headerContent } from './FriendHeader.css';
import { FriendProfile } from './components/FriendProfile';
import useMinimize from './hooks/useMinimize';

Expand All @@ -26,10 +26,12 @@ function FriendHeaderContent() {
});

return (
<div className={clsx(contentWrapper, isMinimize && fixedHeader)}>
<FriendProfile isMinimize={isMinimize} />
<Tabs tabInfos={tabInfos} />
</div>
<header className={clsx(header, isMinimize && minimizeStyle)}>
<div className={headerContent}>
<FriendProfile isMinimize={isMinimize} />
<Tabs tabInfos={tabInfos} />
</div>
</header>
);
}

Expand Down
19 changes: 19 additions & 0 deletions services/web/src/features/Header/MyHeader.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { style } from '@vanilla-extract/css';

export const minimizeStyle = style({});

export const header = style({
background: 'linear-gradient(270deg, #0989FF 0%, #713EFF 98.13%)',

selectors: {
[`&.${minimizeStyle}`]: {
position: 'sticky',
top: 0,
},
},
});

export const headerContent = style({
maxWidth: '720px',
margin: '0 auto',
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { Tabs, TabInfo } from '@linker/lds';
import { clsx } from 'clsx';
import { useRef } from 'react';

import { contentWrapper, fixedHeader } from './MeHeaderContent.css';
import { MeProfile } from './components/MeProfile';
import { minimizeStyle, header, headerContent } from './MyHeader.css';
import { Logo } from './components/Logo'
import { MyProfile } from './components/MyProfile';
import useMinimize from './hooks/useMinimize';

const MINIMIZE_THRESHOLD = 150;
Expand All @@ -24,10 +25,13 @@ function MeHeaderContent() {
});

return (
<div className={clsx(contentWrapper, isMinimize && fixedHeader)}>
<MeProfile isMinimize={isMinimize} />
<Tabs tabInfos={tabInfos} />
</div>
<header className={clsx(header, isMinimize && minimizeStyle)}>
<div className={headerContent}>
{!isMinimize && <Logo />}
<MyProfile isMinimize={isMinimize} />
<Tabs tabInfos={tabInfos} />
</div>
</header>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { style } from '@vanilla-extract/css';

export const wrapper = style({
width: '100%',
padding: '16px 20px',
backgroundColor: 'black',
padding: '14px 20px',
boxSizing: 'border-box',
});

export const logo = style({
margin: 0,
fontSize: '2rem',
fontWeight: 'bold',
lineHeight: '2.4rem',
fontStyle: 'italic',
color: '#ffffff',
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { wrapper, logo } from './Logo.css'

function Logo() {
return (
<div className={wrapper}>
<main className={wrapper}>
<h1 className={logo}>LINKER</h1>
</div>
</main>
)
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export const minimizeStyle = style({});
export const profileWrapper = style({
display: 'flex',
alignItems: 'center',
padding: '1.4rem 2.3rem 2.4rem',
padding: '2rem',

selectors: {
[`&.${minimizeStyle}`]: {
padding: '1.2rem 2.3rem 1.4rem',
padding: '1.2rem 2rem',
},
},
});
Expand All @@ -18,33 +18,26 @@ export const profileImageWrapper = style({
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
overflow: 'hidden',
width: '7.2rem',
height: '7.2rem',
boxSizing: 'content-box',
border: '3px solid #49a15f',
borderRadius: '50%',
border: '2px solid #FFFFFF',
borderRadius: '42%',

selectors: {
[`&.${minimizeStyle}`]: {
width: '3.4rem',
height: '3.4rem',
width: '4rem',
height: '4rem',
},
},
});

export const profileImage = style({
width: '6.7rem',
height: '6.7rem',
width: '100%',
height: '100%',
objectFit: 'cover',
objectPosition: 'top',
borderRadius: '50%',

selectors: {
[`&.${minimizeStyle}`]: {
width: '3rem',
height: '3rem',
},
},
});

export const profileInfo = style({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import {
name,
job,
tag,
} from './MeProfile.css'
} from './MyProfile.css'

interface ProfileProps {
isMinimize: boolean
}

function MeProfile({ isMinimize }: ProfileProps) {
function MyProfile({ isMinimize }: ProfileProps) {
return (
<section className={clsx(profileWrapper, isMinimize && minimizeStyle)}>
<article className={clsx(profileImageWrapper, isMinimize && minimizeStyle)}>
<img
className={clsx(profileImage, isMinimize && minimizeStyle)}
className={clsx(profileImage)}
src="https://thumb.mtstarnews.com/06/2022/02/2022022517263696411_3.jpg"
alt="main profile"
/>
Expand All @@ -36,4 +36,4 @@ function MeProfile({ isMinimize }: ProfileProps) {
);
}

export default MeProfile;
export default MyProfile;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as MyProfile } from './MyProfile';
2 changes: 2 additions & 0 deletions services/web/src/features/Header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as MyHeader } from './MyHeader';
export { default as FriendHeader } from './FriendHeader';
10 changes: 0 additions & 10 deletions services/web/src/features/HeaderContent/FriendHeaderContent.css.ts

This file was deleted.

10 changes: 0 additions & 10 deletions services/web/src/features/HeaderContent/MeHeaderContent.css.ts

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions services/web/src/features/HeaderContent/index.ts

This file was deleted.

0 comments on commit 0153f55

Please sign in to comment.