Skip to content

Commit

Permalink
fix checkbox control color and radio button color
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ committed Apr 19, 2022
1 parent 70e4988 commit 0238b73
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ export default function RadioButtonControl({
'.control-label + .btn-group': {
marginTop: 1,
},
'.btn-group .btn-default': {
color: theme.colors.grayscale.dark1,
},
'.btn-group .btn.active': {
background: theme.colors.secondary.light5,
background: theme.colors.grayscale.light4,
fontWeight: theme.typography.weights.bold,
boxShadow: 'none',
},
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/explore/components/ControlHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const ControlHeader: FC<ControlHeaderProps> = ({
css={(theme: SupersetTheme) =>
css`
margin-bottom: ${theme.gridUnit * 0.5}px;
position: 'relative';
position: relative;
`
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import { styled, css } from '@superset-ui/core';
import ControlHeader from '../ControlHeader';
import Checkbox from '../../../components/Checkbox';

Expand All @@ -32,7 +33,16 @@ const defaultProps = {
onChange: () => {},
};

const checkboxStyle = { paddingRight: '8px' };
const CheckBoxControlWrapper = styled.div`
${({ theme }) => css`
.ControlHeader label {
color: ${theme.colors.grayscale.dark1};
}
span[role='checkbox'] {
padding-right: ${theme.gridUnit * 2}px;
}
`}
`;

export default class CheckboxControl extends React.Component {
onChange() {
Expand All @@ -43,7 +53,6 @@ export default class CheckboxControl extends React.Component {
return (
<Checkbox
onChange={this.onChange.bind(this)}
style={checkboxStyle}
checked={!!this.props.value}
/>
);
Expand All @@ -52,11 +61,13 @@ export default class CheckboxControl extends React.Component {
render() {
if (this.props.label) {
return (
<ControlHeader
{...this.props}
leftNode={this.renderCheckbox()}
onClick={this.onChange.bind(this)}
/>
<CheckBoxControlWrapper>
<ControlHeader
{...this.props}
leftNode={this.renderCheckbox()}
onClick={this.onChange.bind(this)}
/>
</CheckBoxControlWrapper>
);
}
return this.renderCheckbox();
Expand Down

0 comments on commit 0238b73

Please sign in to comment.