Skip to content

Commit

Permalink
chore(channel-filters): add hints for filter values
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Sep 9, 2022
1 parent 2a61b05 commit 42368d8
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ interface FilterProps extends ChannelFilter {
onRemove: () => void;
}

function field2Placeholder(field: string) {
switch (field) {
case 'title':
return 'text';
case 'duration':
return 'duration in minutes';
case 'publishedAt':
return 'date as timestamp';
default:
return 'value';
}
}

export default function Filter(props: FilterProps) {
const { field, operator, value, onChange, onRemove } = props;
const settings = settingsByField[field || fields[0]];
Expand Down Expand Up @@ -72,7 +85,7 @@ export default function Filter(props: FilterProps) {
<Input
value={value}
type={settings.type}
placeholder="value"
placeholder={field2Placeholder(field)}
onChange={handleValueChange}
/>
<IconButton aria-label="remove" size="small" onClick={onRemove}>
Expand Down

0 comments on commit 42368d8

Please sign in to comment.