|
|
@@ -18,6 +18,7 @@ import React from 'react'
|
|
|
import styled, { css } from 'styled-components'
|
|
|
|
|
|
import arrowImage from './images/arrow.js'
|
|
|
+import starImage from './images/star.js'
|
|
|
|
|
|
import Palette from '../../styleUtils/Palette'
|
|
|
import StyleProps from '../../styleUtils/StyleProps'
|
|
|
@@ -35,7 +36,7 @@ const getLabelColor = props => {
|
|
|
}
|
|
|
const Label = styled.div`
|
|
|
color: ${props => getLabelColor(props)};
|
|
|
- margin: 0 32px 0 16px;
|
|
|
+ margin: 0 ${props => props.required ? 44 : 32}px 0 16px;
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
|
@@ -84,7 +85,12 @@ const borderColor = props => {
|
|
|
}
|
|
|
return Palette.grayscale[3]
|
|
|
}
|
|
|
-
|
|
|
+const Required = styled.div`
|
|
|
+ position: absolute;
|
|
|
+ top: 7px;
|
|
|
+ right: 29px;
|
|
|
+ background: url('${starImage}') center no-repeat;
|
|
|
+`
|
|
|
const Wrapper = styled.div`
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -112,6 +118,10 @@ const Wrapper = styled.div`
|
|
|
&:hover ${Label} {
|
|
|
color: ${props => props.disabled ? '' : props.embedded ? '' : 'white'};
|
|
|
}
|
|
|
+
|
|
|
+ &:hover ${Required} #star {
|
|
|
+ stroke: white;
|
|
|
+ }
|
|
|
`
|
|
|
const Arrow = styled.div`
|
|
|
position: absolute;
|
|
|
@@ -128,6 +138,7 @@ type Props = {
|
|
|
disabled?: boolean,
|
|
|
'data-test-id'?: string,
|
|
|
embedded?: boolean,
|
|
|
+ required?: boolean,
|
|
|
}
|
|
|
class DropdownButton extends React.Component<Props> {
|
|
|
render() {
|
|
|
@@ -150,7 +161,10 @@ class DropdownButton extends React.Component<Props> {
|
|
|
innerRef={() => { }}
|
|
|
data-test-id="dropdownButton-value"
|
|
|
disabled={this.props.disabled}
|
|
|
- >{this.props.value}</Label>
|
|
|
+ >
|
|
|
+ {this.props.value}
|
|
|
+ </Label>
|
|
|
+ {this.props.required ? <Required dangerouslySetInnerHTML={{ __html: starImage }} /> : null}
|
|
|
<Arrow
|
|
|
{...this.props}
|
|
|
innerRef={() => { }}
|