Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uikit5 #28

Merged
merged 5 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: '18.x'
cache: 'npm'
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Preview Build
name: PR Preview Build

on:
pull_request:
Expand All @@ -10,4 +10,4 @@ jobs:
steps:
- uses: gravity-ui/preview-build-action@v1
with:
node-version: 14
node-version: 18
4 changes: 2 additions & 2 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Preview Deploy
name: PR Preview Deploy

on:
workflow_run:
workflows: ['Preview Build']
workflows: ['PR Preview Build']
types:
- completed

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
with:
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
node-version: 14
node-version: 18
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
17 changes: 0 additions & 17 deletions .storybook/decorators/withTheme.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions .storybook/main.js

This file was deleted.

19 changes: 19 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type {StorybookConfig} from '@storybook/react-webpack5';
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
'@storybook/addon-interactions',
'@storybook/preset-scss',
],
framework: {
name: '@storybook/react-webpack5',
options: {fastRefresh: true},
},
docs: {
autodocs: 'tag',
defaultName: 'Docs',
},
};
export default config;
6 changes: 0 additions & 6 deletions .storybook/manager.js

This file was deleted.

82 changes: 0 additions & 82 deletions .storybook/preview.js

This file was deleted.

66 changes: 66 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React from 'react';

import type {Preview, Decorator} from '@storybook/react';
import '@gravity-ui/uikit/styles/styles.scss';

import {ThemeProvider, MobileProvider, configure as uikitConfigure} from '@gravity-ui/uikit';

export const withContextProvider: Decorator = (StoryItem, context) => {
return (
<React.StrictMode>
<ThemeProvider theme={context.globals.theme}>
<MobileProvider>
<StoryItem {...context} />
</MobileProvider>
</ThemeProvider>
</React.StrictMode>
);
};

export const withLang: Decorator = (StoryItem, context) => {
const lang = context.globals.lang;
uikitConfigure({lang});

return <StoryItem {...context} />;
};

const preview: Preview = {
decorators: [withContextProvider, withLang],
parameters: {
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
globalTypes: {
lang: {
name: 'Language',
defaultValue: 'ru',
toolbar: {
icon: 'globe',
items: [
{value: 'ru', right: '🇷🇺', title: 'Ru'},
{value: 'en', right: '🇺🇸', title: 'En'},
],
},
},
theme: {
name: 'Theme',
defaultValue: 'light',
toolbar: {
icon: 'mirror',
items: [
{title: 'light', value: 'light'},
{title: 'dark', value: 'dark'},
{title: 'light-hc', value: 'light-hc'},
{title: 'dark-hc', value: 'dark-hc'},
],
},
},
},
};

export default preview;
32 changes: 0 additions & 32 deletions .storybook/theme.js

This file was deleted.

7 changes: 7 additions & 0 deletions .storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "..",
"compilerOptions": {
"module": "commonjs",
"target": "ES2017"
}
}
2 changes: 0 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ module.exports = {
preset: 'ts-jest',
moduleDirectories: ['node_modules', 'src/lib'],
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
testEnvironment: 'jsdom',
testMatch: ['**/*.test.js'],
transform: {
'src/test/.+\\.(j|t)sx?$': 'ts-jest',
},
transformIgnorePatterns: ['node_modules/(?!(@yandex-cloud)/)'],
};
Loading
Loading