borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
557 stars 20 forks source link

Styled-components syntax highlighting syntax with nested #254

Open kud opened 4 years ago

kud commented 4 years ago

image

const Timeline = styled.ul`
  list-style: none;
  display: flex;
  width: 100%;
  margin: 0;
  padding: 6rem 0;
  font-family: var(--font-family-cond-semibold);
  letter-spacing: 0.1rem;

  ${({ finished }) =>
    finished &&
    css`
      ${Timeline.Item}:last-of-type {
        ${Timeline.Item.Bullet} {
          background: yellow;
        }
      }
    `}
`

Timeline.Item = styled.li`
  display: flex;
  position: relative;
  flex-grow: 1;
  text-align: center;

  &:before,
  &:after {
    content: "";
    flex-grow: 1;
    border-top: 2px solid white;
    margin-top: 20px;
  }

  &:first-of-type {
    text-align: left;
  }

  &:last-of-type {
    text-align: right;
  }

  &:first-of-type:before {
    display: none;
  }

  &:last-of-type:after {
    display: none;
  }

  ${({ isSelected }) =>
    isSelected &&
    css`
      ${Timeline.Item.Header.When} {
        margin-top: -0.3rem;
        font-size: 1.4rem;
      }

      ${Timeline.Item.Header.When} {
        font-size: 1.4rem;
      }
    `}
`