Граф коммитов

19 Коммитов

Автор SHA1 Сообщение Дата
Nora d5932fc1de Use storybook type 2024-01-25 08:25:33 +00:00
Nora 8397f58d0b Disable rule for storybook types 2024-01-24 17:27:52 +00:00
Koen Vlaswinkel 9d6962ede2 Enforce consistent type imports 2024-01-05 17:13:45 +01:00
Koen Vlaswinkel 7a7092de0d Add eslint-plugin-import
It seems like we had some rules that disabled rules of this plugin, but
we didn't actually have it installed. I've now installed it, used the
recommended configuration, and removed our own disable rules. I've fixed
any errors that this introduced.
2023-12-21 17:02:37 +01:00
Koen Vlaswinkel 56697a9c2f Add storybook/addon-a11y package 2023-10-12 11:52:47 +02:00
Robert 3d415d2852 Avoid using "as any" in preview.ts 2023-09-18 15:14:28 +01:00
Koen Vlaswinkel 8329dedd7f Upgrade to Storybook 7 2023-07-18 15:07:15 +02:00
Koen Vlaswinkel bb05220b2c Fix Babel compilation error
The default Storybook Babel config did not recognize the `public`
keyword in our custom errors (e.g. `ExhaustivityCheckingError`
and `RedactableError`). To fix this, we can use Storybook's V7 mode to
supply a custom Babel config. This fixes the compilation error.

See: https://storybook.js.org/docs/react/configure/babel
2023-04-06 13:35:10 +02:00
Koen Vlaswinkel 3fdc328767 Add additional Storybook VSCode themes
This adds four new VSCode themes to Storybook which will allow us to
more easily test these themes in Storybook. These themes were chosen
because they are either used for accessibility (the high contrast
themes) or are currently not compatible with the variant analysis UI
(there are items that are not visible).
2022-11-29 16:49:04 +01:00
Koen Vlaswinkel ebcdf8ad0b Run Prettier on all files
This will change all existing files to match Prettier formatting.

The command used is `npm run format`.
2022-11-16 19:06:13 +01:00
Koen Vlaswinkel c1f24142c9 Run ESLint on all files
This wil remove the discrepancy between the files on which ESLint is run
when `lint-staged` is used and the files that are checked using
`npm run lint` and `npm run format`.

It will now also include the `.storybook` directory which was previously
excluded from the ESLint configuration.
2022-10-31 13:22:27 +01:00
Koen Vlaswinkel a254ceaa59 Create Storybook add-on for switching VSCode themes
This adds a Storybook add-on that allows you to switch between VSCode
theme. It follows the pattern of the [outline](https://github.com/storybookjs/storybook/tree/v6.5.12/addons/outline/src)
and [backgrounds](https://github.com/storybookjs/storybook/tree/v6.5.12/addons/backgrounds)
add-ons.

Unfortunately, it doesn't apply the CSS to just the elements it should
be applied to, but globally to the complete preview. This is a limitation
of using CSS files rather than setting inline styles on the elements. We
might be able to resolve this in the future by extracting the CSS
variables from the CSS files, but this is somewhat more involved.
2022-10-19 11:01:25 +02:00
Koen Vlaswinkel 157a5d6afd Add VSCode light theme to Storybook
This adds a documented way to change the theme in Storybook from the
VSCode Dark+ theme to the VSCode Light+ theme. It requires multiple
changes to two files, but these are all quite simple and it has been
documented on the "Overview" page.
2022-10-18 16:25:53 +02:00
Koen Vlaswinkel d8fbc56ec2 Restore variant analysis view on restart of VSCode
This implements persistence for the variant analysis webview, allowing
the webview panel to be restored when VSCode is restarted. It's probably
easier to add this now than to try to add it later.

The basic idea is that there are no real differences when opening the
webview for the first time. However, when VSCode is restarted it will
use the `VariantAnalysisViewSerializer` to restore the webview panel.
In our case this means recreating the `VariantAnalysisView`.

To fully test this, I've also added a mock variant analysis ID as the
state of the webview. This value is now randomly generated when calling
the `codeQL.mockVariantAnalysisView` command. This allows us to test
opening multiple webviews and that the webviews are restored with the
correct state.

See: https://code.visualstudio.com/api/extension-guides/webview#persistence
2022-09-29 13:26:56 +02:00
Koen Vlaswinkel 9383b03971 Move Storybook config to TypeScript 2022-09-07 16:41:42 +02:00
Koen Vlaswinkel baf130d60e Remove WebView UI Toolkit stories 2022-09-07 16:37:37 +02:00
Koen Vlaswinkel d15e3885d7 Add documentation about parameters in preview.js 2022-09-07 16:36:24 +02:00
Koen Vlaswinkel 2211e2317d Add mock VSCode API in Storybook
This allows us to add a story for the "main" remote queries view.
2022-09-07 14:35:04 +02:00
Koen Vlaswinkel 6018ebaca9 Setup Storybook for testing UI components
This sets up Storybook for testing of React components. It adds stories
for some of the MRVA components. It does not add stories for the main
MRVA views since those are not independent of VSCode and need to be run
from within VSCode.
2022-09-06 10:55:55 +02:00