Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

docs(input): fix input type knob #942

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/components/input/stories/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2020
* Copyright IBM Corp. 2019, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -10,21 +10,20 @@
import { action } from '@storybook/addon-actions';
import { INPUT_COLOR_SCHEME, INPUT_SIZE, INPUT_TYPE } from '../input';

const inputTypes = {};
const inputTypes = Object.entries(INPUT_TYPE).reduce(
(acc, [key, val]) => ({
...acc,
[`${key.toLowerCase()}`]: val,
}),
{}
);

const sizes = {
Regular: null,
[`Small size (${INPUT_SIZE.SMALL})`]: INPUT_SIZE.SMALL,
[`Extra large size (${INPUT_SIZE.EXTRA_LARGE})`]: INPUT_SIZE.EXTRA_LARGE,
};

const keys = Object.keys(INPUT_TYPE);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const value = keys[key];
inputTypes[key.toLowerCase()] = value;
}

const colorSchemes = {
[`Regular`]: null,
[`Light (${INPUT_COLOR_SCHEME.LIGHT})`]: INPUT_COLOR_SCHEME.LIGHT,
Expand Down