Skip to content

Commit

Permalink
Select: Mark todos
Browse files Browse the repository at this point in the history
  • Loading branch information
marco committed Apr 13, 2021
1 parent bed9227 commit 2af4c80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Input/DownshiftSelect/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const Template: Story<Props> = args => (
/>
);

// TODO: Cannot delete from middle of input
export const Interactive = Template.bind({});
Interactive.args = { label: 'Select An Item', helperText: 'Type to filter' };
Interactive.parameters = {
Expand Down Expand Up @@ -228,7 +229,7 @@ DownshiftOptions.parameters = {

export const Disabled = Template.bind({});
Disabled.args = {
disabled: true,
disabled: true, //TODO
label: 'Select An Option',
placeholder: 'I am placeholder',
helperText: 'I am helper text',
Expand Down Expand Up @@ -500,6 +501,7 @@ EmptyListText.parameters = {
},
};

// TODO: Realsistic example
export const AsyncItems: Story<Props> = () => {
const [sampleItems, setSampleItems] = useState<Item[]>(sampleSize(items, 2));
return (
Expand Down
5 changes: 5 additions & 0 deletions src/Input/DownshiftSelect/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ export interface Item {
[x: string]: any;
}

// TODO: use includes
export const defaultTransformFunction = (items: Item[], inputValue: string) =>
items.filter(item =>
item.label.toLowerCase().startsWith(inputValue.toLowerCase())
);

// TODO: rename
export const defaultItemToString = (item: Item) => (item ? item.label : '');

export const defaultEmptyListText =
'No results found. Try another keyword to search for.';

// TODO: Organize exports for external users
// TODO: Remove empty types here
// These are our custom props for our subcomponents. We need this because
// sometimes we want to make additional props available to the subcomponent,
// e.g. a Item subcomponent needs to know the item it represents.
Expand Down Expand Up @@ -321,6 +325,7 @@ export const Select: React.FC<Props> & { Components: Components } = ({
})}
aria-label="toggle menu"
data-testid="toggle-button"
// TODO: Explain with comment
ref={undefined}
>
{isOpen ? <ArrowUpIcon /> : <ArrowDownIcon />}
Expand Down

0 comments on commit 2af4c80

Please sign in to comment.