Fix styling of listview disabled items
Summary: Also improved some paddings Reviewed By: passy Differential Revision: D19640179 fbshipit-source-id: 44aa91d452fc857533c638e00d4fe9648592b6f2
This commit is contained in:
committed by
Facebook Github Bot
parent
40359a9b68
commit
c33dbce242
@@ -55,6 +55,7 @@ type Props = OwnProps & StateFromProps & DispatchFromProps;
|
|||||||
const Container = styled(FlexColumn)({
|
const Container = styled(FlexColumn)({
|
||||||
width: 700,
|
width: 700,
|
||||||
maxHeight: 700,
|
maxHeight: 700,
|
||||||
|
padding: 8,
|
||||||
});
|
});
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
colors,
|
colors,
|
||||||
View,
|
View,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
Glyph,
|
||||||
} from '../ui';
|
} from '../ui';
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ type State = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Container = styled(FlexColumn)({
|
const Container = styled(FlexColumn)({
|
||||||
padding: 8,
|
padding: '8 0',
|
||||||
});
|
});
|
||||||
|
|
||||||
const Line = styled(View)({
|
const Line = styled(View)({
|
||||||
@@ -90,7 +91,7 @@ type RowComponentProps = {
|
|||||||
label: string;
|
label: string;
|
||||||
selected: boolean;
|
selected: boolean;
|
||||||
onChange: (name: string, selected: boolean) => void;
|
onChange: (name: string, selected: boolean) => void;
|
||||||
disable: boolean;
|
disabled: boolean;
|
||||||
toolTipMessage?: string;
|
toolTipMessage?: string;
|
||||||
type: SelectionType;
|
type: SelectionType;
|
||||||
};
|
};
|
||||||
@@ -102,25 +103,35 @@ class RowComponent extends Component<RowComponentProps> {
|
|||||||
label,
|
label,
|
||||||
selected,
|
selected,
|
||||||
onChange,
|
onChange,
|
||||||
disable,
|
disabled,
|
||||||
toolTipMessage,
|
toolTipMessage,
|
||||||
type,
|
type,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
<FlexColumn>
|
<FlexColumn>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={disable ? toolTipMessage : null}
|
title={disabled ? toolTipMessage : null}
|
||||||
options={{position: 'toRight'}}>
|
options={{position: 'toRight'}}>
|
||||||
<Padder
|
<Padder
|
||||||
paddingRight={8}
|
paddingRight={0}
|
||||||
paddingTop={8}
|
paddingTop={8}
|
||||||
paddingBottom={8}
|
paddingBottom={8}
|
||||||
paddingLeft={8}>
|
paddingLeft={0}>
|
||||||
<FlexRow>
|
<FlexRow style={{alignItems: 'center'}}>
|
||||||
<Text> {label} </Text>
|
<Text color={disabled ? colors.light20 : undefined}>{label}</Text>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
|
{disabled && (
|
||||||
|
<Glyph
|
||||||
|
name="caution-triangle"
|
||||||
|
color={colors.light20}
|
||||||
|
size={12}
|
||||||
|
variant="filled"
|
||||||
|
style={{marginRight: 5}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{type === 'multiple' && (
|
{type === 'multiple' && (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
disabled={disabled}
|
||||||
checked={selected}
|
checked={selected}
|
||||||
onChange={selected => {
|
onChange={selected => {
|
||||||
onChange(id, selected);
|
onChange(id, selected);
|
||||||
@@ -129,6 +140,7 @@ class RowComponent extends Component<RowComponentProps> {
|
|||||||
)}
|
)}
|
||||||
{type === 'single' && (
|
{type === 'single' && (
|
||||||
<Radio
|
<Radio
|
||||||
|
disabled={disabled}
|
||||||
checked={selected}
|
checked={selected}
|
||||||
onChange={selected => {
|
onChange={selected => {
|
||||||
onChange(id, selected);
|
onChange(id, selected);
|
||||||
@@ -194,7 +206,7 @@ export default class ListView extends Component<Props, State> {
|
|||||||
type={type}
|
type={type}
|
||||||
selected={this.state.selectedElements.has(id)}
|
selected={this.state.selectedElements.has(id)}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
disable={unselectable != null}
|
disabled={unselectable != null}
|
||||||
toolTipMessage={unselectable?.toolTipMessage}
|
toolTipMessage={unselectable?.toolTipMessage}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ type CheckboxProps = {
|
|||||||
checked: boolean;
|
checked: boolean;
|
||||||
/** Called when a state change is triggered */
|
/** Called when a state change is triggered */
|
||||||
onChange: (checked: boolean) => void;
|
onChange: (checked: boolean) => void;
|
||||||
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CheckboxContainer = styled.input({
|
const CheckboxContainer = styled.input({
|
||||||
@@ -39,6 +40,7 @@ export default class Checkbox extends PureComponent<CheckboxProps> {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={this.props.checked}
|
checked={this.props.checked}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
|
disabled={this.props.disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ type RadioProps = {
|
|||||||
checked: boolean;
|
checked: boolean;
|
||||||
/** Called when a state change is triggered */
|
/** Called when a state change is triggered */
|
||||||
onChange: (selected: boolean) => void;
|
onChange: (selected: boolean) => void;
|
||||||
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const RadioboxContainer = styled.input({
|
const RadioboxContainer = styled.input({
|
||||||
@@ -39,6 +40,7 @@ export default class Radio extends PureComponent<RadioProps> {
|
|||||||
type="radio"
|
type="radio"
|
||||||
checked={this.props.checked}
|
checked={this.props.checked}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
|
disabled={this.props.disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user