Last active
March 16, 2022 04:42
-
-
Save ashimon83/f8f6c87ad23777d12ce9e65e05fcfbb9 to your computer and use it in GitHub Desktop.
styled-component-with-svg-loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Logo from './logo.svg' | |
type StyledLogoProps = { | |
active: boolean | |
} | |
// styled-componentsでスタイル定義を直接書いて大きさを指定したり動的にpropsで状態を変化させたりできる。便利。 | |
const StyledLogo = styled(Logo)<StyledLogoProps>` | |
color: ${p => p.active ? 'red' : 'blue'}; | |
width: 20px; | |
height: 20px; | |
` | |
// <StyledLogo active={active} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment