React - macro component conditional rendering for CSS properties with emotion props

0 votes
249 views
added Apr 28, 2021 in React by lcjr First Warrant Officer (11,890 points)
edited May 4, 2021 by lcjr
import styled from '@emotion/styled';
import { keyframes } from '@emotion/react';

const bounce = keyframes`
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
`;

const Button = styled.button`
  border: 0;
  background: 0 0;
  padding: 10px 14px 5px;
  color: ${props => props.theme.colors.primary}; 
  height: 40px;  
  border: 1px solid ${props => props.theme.type === "theme1" ? 'transparent' : props.theme.colors.primary};
  &:after {
    content:'${props => props.theme.type === "theme1" ? '' : 'share'}';
  }
`;

export default Button;

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...