insomnia/packages/insomnia-components
Dimitri Mitropoulos 860565f3a6
fixes react controlled input error (#3391)
* fix ts-expect-error

* removes useless await

see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md

We're not quite ready to have this rule on everywhere, but in this case I can see that it's correct to follow.

* add comment about magic number

and moves the assignment to the one place it's used

I opted not to make a ticket because we are recently running out of tickets and this seems to be a relatively small thing @reynolek please confirm this is the correct course of action.

* initialize ref to reflect reality (and include actual type)

* fixes root cause of error, inlines one-liners

the error with the type of `_handleInputColorChange` was due to `onChange` being the wrong prop to use (where `onChange` is the one we want).

* use onChange instead of onInput to access correct types

ultimately, since react's behavior diverged from the DOM behavior to match onInput, this should have no effect on any functionality since react assigns this event to `onChange` anyway.  see https://github.com/facebook/react/blob/master/fixtures/attribute-behavior/src/attributes.js#L2089

* clears remaining ts-expect-errors in file

* updates fallback call per review feedback
2021-05-19 08:24:01 -04:00
..
.storybook [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
src fixes react controlled input error (#3391) 2021-05-19 08:24:01 -04:00
webpack [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
.eslintignore [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
.eslintrc.js [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
.gitignore keep the previous svgr assets dir in gitignore (#3372) 2021-05-12 07:58:22 -04:00
.npmignore Remove built files from source control and update bootstrap steps (#2165) 2020-05-15 08:57:03 +12:00
.nvmrc Fix netlify/storybook deployment issues (#2572) 2020-08-31 21:58:54 +12:00
jest.config.js remove duplication of all jest configs (#3375) 2021-05-13 07:29:02 -04:00
package-lock.json Fix vercel deployments (#3378) 2021-05-13 10:49:58 +12:00
package.json chore: add repository, bug urls, and license to plugins missing it (#3379) 2021-05-13 07:31:33 -04:00
README.md Initial designer merge 2020-04-26 13:33:39 -07:00
svgr.config.js [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
tsconfig.build.json [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
tsconfig.json [TypeScript] Phase 1 & 2 (#3370) 2021-05-12 18:35:00 +12:00
vercel.json Replace Netlify with Vercel for Storybook (#3212) 2021-03-19 14:52:45 +01:00

insomnia-components

insomnia-components is a React component library of UI elements needed to build Insomnia. Explore the components via Storybook!

SVGs

We use SVGR on the source SVGs to minify and convert them to React components. This conversion happens during npm run bootstrap.

The generated icons can automatically be bound to the theme library built into Insomnia, by following a few rules. In the source SVG:

  1. All background colors should be black (#000)
  2. All foreground colors should be white (#FFF)

SVGR converts these colors to fill='' and fill='currentColor' respectively. These icons are exposed via svg-icon.js, which sets the css fill and color of the SVG according to the required theme.

You can view the current icons available here.