|
1 | 1 | import React from 'react'; |
2 | 2 | import propTypes from 'prop-types'; |
3 | 3 |
|
4 | | -import styled, { css } from 'styled-components'; |
| 4 | +import styled from 'styled-components'; |
5 | 5 |
|
6 | 6 | const SlyledWindowHeader = styled.div` |
7 | 7 | height: 30px; |
8 | 8 | line-height: 30px; |
9 | 9 | padding-left: 0.25rem; |
10 | 10 | font-weight: bold; |
11 | 11 |
|
12 | | - color: ${({ theme, isActive }) => |
13 | | - isActive ? theme.textInvert : theme.material}; |
14 | | -
|
15 | | - ${({ theme, isActive }) => |
16 | | - isActive |
17 | | - ? css` |
18 | | - background: linear-gradient( |
19 | | - to right, |
20 | | - ${theme.headerMaterialDark}, |
21 | | - ${theme.headerMaterialLight} |
22 | | - ); |
23 | | - ` |
24 | | - : css` |
25 | | - background: ${theme.headerNotActive}; |
26 | | - `} |
| 12 | + &[data-active='false'] { |
| 13 | + background: ${({ theme }) => theme.headerNotActive}; |
| 14 | + color: ${({ theme }) => theme.material}; |
| 15 | + } |
| 16 | + &[data-active='true'] { |
| 17 | + background: linear-gradient( |
| 18 | + to right, |
| 19 | + ${({ theme }) => theme.headerMaterialDark}, |
| 20 | + ${({ theme }) => theme.headerMaterialLight} |
| 21 | + ); |
| 22 | + color: ${({ theme }) => theme.textInvert}; |
| 23 | + } |
27 | 24 | `; |
28 | 25 | // TODO - should we add some aria label indicating if window is currently active? |
29 | 26 | const WindowHeader = ({ isActive, children, ...otherProps }) => ( |
30 | | - <SlyledWindowHeader isActive={isActive} {...otherProps}> |
| 27 | + <SlyledWindowHeader data-active={isActive.toString()} {...otherProps}> |
31 | 28 | {children} |
32 | 29 | </SlyledWindowHeader> |
33 | 30 | ); |
|
0 commit comments