Skip to content

Instantly share code, notes, and snippets.

@ashimon83
Last active March 16, 2022 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashimon83/f8f6c87ad23777d12ce9e65e05fcfbb9 to your computer and use it in GitHub Desktop.
Save ashimon83/f8f6c87ad23777d12ce9e65e05fcfbb9 to your computer and use it in GitHub Desktop.
styled-component-with-svg-loader
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