Replies: 2 comments
-
저는 통일은 하지 않고 경우에 따라 적절한 방법을 썼으면 좋겠습니다 하지만 일반적으로 svg 아이콘을 이용하는 경우 svgr을 통해 svg를 컴포넌트화 해서 사용하는 방법이 좋다고 생각합니다 이유
사용 예시 (pages/login.tsx) import styled from '@emotion/styled';
import ImageLogo from 'public/images/image-logo.svg';
import LetterLogo from 'public/images/letter-logo.svg';
import GoogleLoginButton from '@/components/login/GoogleLoginButton';
export default function LoginPage() {
return (
<Container>
<StyledImageLogo />
<StyledLetterLogo />
<Slogan>What’s your Hype Music?</Slogan>
<GoogleLoginButton />
<Footer>© 6Jeans. All rights reversed.</Footer>
</Container>
);
}
const Container = styled.div`
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
`;
const StyledImageLogo = styled(ImageLogo)`
margin-top: 24.6rem;
`;
const StyledLetterLogo = styled(LetterLogo)`
margin-top: 3.8rem;
`;
const Slogan = styled.div`
color: #7893ea;
font-style: normal;
font-weight: 500;
font-size: 2rem;
line-height: 3rem;
margin-top: 5.2rem;
margin-bottom: auto;
`;
const Footer = styled.footer`
font-style: normal;
font-weight: 300;
font-size: 11px;
line-height: 16px;
color: #9f9f9f;
margin-top: 5.6rem;
margin-bottom: 2.2rem;
`; |
Beta Was this translation helpful? Give feedback.
0 replies
-
img 태그를 써야 할 때에는 해당 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
✨ 의견
사용되는 Icon 이미지를 컴포넌트화 해서 사용하면 어떨까요?
예시 코드
장점
import
하지 않아도 되고,Icon
컴포넌트만import
하면 되기 때문에 간결하다.alt
속성 작성하는 것을 까먹을 수 있다. 이러한 상황을 방지하는 방법이 될 수 있다.prop
으로 넘겨줘서 사용하기 때문에 간편하고,styled-component
를 사용할 때마다 만들지 않아도 된다.Beta Was this translation helpful? Give feedback.
All reactions