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

⚡ SVG Sprite를 활용한 SVG 관리 #22

Merged
merged 7 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions public/assets/sprites/common.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions src/features/feed-main-header/ui/FeedMainHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
display: flex;

.icon-link {
@include responsive-dimensions(44px, 44px);

display: flex;
align-items: center;
justify-content: center;
@include fixed-box(44px, 44px);
}
}
}
19 changes: 8 additions & 11 deletions src/features/feed-main-header/ui/FeedMainHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { Link } from 'react-router-dom';

import NotificationIcon from '@/shared/ui/icon/assets/notification_icon.svg?react';
import PennywayLogo from '@/shared/ui/icon/assets/pennyway_logo_icon.svg?react';
import SearchIcon from '@/shared/ui/icon/assets/search_icon.svg?react';
import WritingIcon from '@/shared/ui/icon/assets/writing_icon.svg?react';
import { Icon } from '@/shared/ui';

import './FeedMainHeader.scss';

export const FeedMainHeader = () => {
return (
<header id='feed-main-header'>
<div className='header-left'>
<PennywayLogo />
<Icon name='pennyway-logo' width='99' height='17.32' />
</div>
<nav className='header-right'>
<Link to='search' className='icon-link'>
<SearchIcon />
<Link to='search' className='icon icon-link'>
<Icon name='search' width='24' height='24' />
</Link>
<Link to='writing' className='icon-link'>
<WritingIcon />
<Link to='writing' className='icon icon-link'>
<Icon name='writing' width='24' height='24' />
</Link>
<Link to='notification' className='icon-link'>
<NotificationIcon />
<Link to='notification' className='icon icon-link'>
<Icon name='notification' width='24' height='24' />
</Link>
</nav>
</header>
Expand Down
10 changes: 3 additions & 7 deletions src/features/feed/ui/Feed.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
align-items: center;

.kebab-icon-btn {
@include responsive-dimensions(44px, 44px);

display: flex;
justify-content: center;
align-items: center;
@include fixed-box(44px, 44px);
}
}

Expand All @@ -32,7 +28,7 @@
align-items: center;

.count-divider {
@include responsive-dimensions(2px, 2px);
@include responsive-box(2px, 2px);

margin: 0 4px;
background-color: $gray4;
Expand All @@ -56,7 +52,7 @@
}

.icon-btn {
@include responsive-dimensions(20px, 20px);
@include fixed-box(20px, 20px);
}
}
}
Expand Down
27 changes: 11 additions & 16 deletions src/features/feed/ui/Feed.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { Profile } from '@/shared/ui';
import BookmarkIcon from '@/shared/ui/icon/assets/bookmark_icon.svg?react';
import ChatIcon from '@/shared/ui/icon/assets/chat_icon.svg?react';
import KebabMenuIcon from '@/shared/ui/icon/assets/kebab_menu_icon.svg?react';
import LikeIcon from '@/shared/ui/icon/assets/like_icon.svg?react';
import SharedIcon from '@/shared/ui/icon/assets/share_icon.svg?react';
import { Icon, Profile } from '@/shared/ui';
import { calculateElapsedTime } from '@/shared/utils';

import './Feed.scss';
Expand All @@ -22,8 +17,8 @@ export const Feed: React.FC<FeedProps> = ({ feed }) => {
content={calculateElapsedTime(updatedAt)}
/>

<button className='kebab-icon-btn'>
<KebabMenuIcon />
<button className='icon kebab-icon-btn'>
<Icon name='kebab-menu' width='20' height='20' color='red' />
</button>
</header>
<div className='feed-content'>
Expand All @@ -36,19 +31,19 @@ export const Feed: React.FC<FeedProps> = ({ feed }) => {
</div>
<footer className='feed-footer'>
<div className='footer-left'>
<button className='icon-btn'>
<LikeIcon />
<button className='icon icon-btn'>
<Icon name='like' width='20' height='20' />
</button>
<button className='icon-btn'>
<ChatIcon />
<button className='icon icon-btn'>
<Icon name='chat' width='20' height='20' />
</button>
<button className='icon-btn'>
<SharedIcon />
<button className='icon icon-btn'>
<Icon name='share' width='20' height='20' />
</button>
</div>
<div className='footer-right'>
<button className='icon-btn'>
<BookmarkIcon />
<button className='icon icon-btn'>
<Icon name='bookmark' width='20' height='20' />
</button>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/styles/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@forward 'colors.scss';
@forward 'fonts.scss';
@forward 'responsive.scss';
@forward 'box.scss';
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
@mixin responsive-dimensions($default-width, $default-height) {
@mixin fixed-box($default-width, $default-height) {
width: $default-width;
height: $default-height;
}

@mixin responsive-box($default-width, $default-height) {
width: $default-width;
height: $default-height;

Expand Down
6 changes: 6 additions & 0 deletions src/shared/styles/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,9 @@ button {
border: none;
padding: 0;
}

.icon {
display: flex;
justify-content: center;
align-items: center;
}
6 changes: 3 additions & 3 deletions src/shared/ui/button/ActiveButton.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '@/shared/styles/_index.scss' as *;

@mixin confirmButton($isDisabled: false) {
@include responsive-dimensions(108px, 40px);
@include responsive-box(108px, 40px);
@extend .h4semi;
border-radius: 4px;

Expand All @@ -25,10 +25,10 @@
border-radius: 30px;

@if $isLg {
@include responsive-dimensions(280px, 30px);
@include responsive-box(280px, 30px);
@extend .b1semi;
} @else {
@include responsive-dimensions(48px, 24px);
@include responsive-box(48px, 24px);
@extend .b2semi;
}
@if $isDisabled {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/ui/button/BasicButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
}

.confirm-cancle {
@include responsive-dimensions(108px, 40px);
@include responsive-box(108px, 40px);
@extend .h4semi;
border-radius: 4px;
color: $gray4;
background-color: $gray2;
}

.bsm-option {
@include responsive-dimensions(280px, 40px);
@include responsive-box(280px, 40px);
@extend .h4md;
background-color: $gray1;
color: $gray5;
Expand All @@ -21,7 +21,7 @@
}

.bsm-cancle {
@include responsive-dimensions(280px, 47px);
@include responsive-box(280px, 47px);
@extend .h4semi;
text-align: center;
background-color: $gray5;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/header/PageHeader.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '@/shared/styles/_index.scss' as *;

.page-header {
@include responsive-dimensions(320px, 44px);
@include responsive-box(320px, 44px);
display: flex;
align-items: center;
justify-content: space-between;
Expand Down
5 changes: 3 additions & 2 deletions src/shared/ui/header/PageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from 'react-router-dom';

import BackIcon from '@/shared/ui/icon/assets/back_icon.svg?react';
import { Icon } from '..';

import './PageHeader.scss';

interface PageHeaderProps {
Expand All @@ -12,7 +13,7 @@ export const PageHeader = ({ prevPageLink, page }: PageHeaderProps) => {
return (
<div className='page-header'>
<Link to={prevPageLink}>
<BackIcon />
<Icon name='back' width='44' height='44' />
</Link>
<p className='page'>{page}</p>
</div>
Expand Down
3 changes: 0 additions & 3 deletions src/shared/ui/icon/assets/back_icon.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/shared/ui/icon/assets/bookmark_icon.svg

This file was deleted.

4 changes: 0 additions & 4 deletions src/shared/ui/icon/assets/chat_icon.svg

This file was deleted.

5 changes: 0 additions & 5 deletions src/shared/ui/icon/assets/kebab_menu_icon.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/shared/ui/icon/assets/like_icon.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/shared/ui/icon/assets/notification_icon.svg

This file was deleted.

Loading
Loading