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

added preview flow #271

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 13 additions & 0 deletions .github/workflows/pr-preview-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR Preview Build

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-build-action@v1
with:
node-version: 18
22 changes: 22 additions & 0 deletions .github/workflows/pr-preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR Preview Deploy

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

jobs:
deploy:
name: Deploy
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-deploy-action@v1
with:
project: landing
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
18 changes: 18 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type {StorybookConfig} from '@storybook/react-webpack5';

const config: StorybookConfig = {
framework: {
name: '@storybook/react-webpack5',
options: {fastRefresh: true},
},
stories: ['../demo/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
],
typescript: {
check: true,
},
};

export default config;
6 changes: 6 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {addons} from '@storybook/addons';
import {themes} from './theme';

addons.setConfig({
theme: themes.light,
});
47 changes: 47 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type {Preview} from '@storybook/react';
import {MINIMAL_VIEWPORTS} from '@storybook/addon-viewport';

import {withThemeProvider, withLang} from '../demo/utils/preview';

const preview: Preview = {
decorators: [withThemeProvider, withLang],
parameters: {
jsx: {showFunctions: true}, // To show functions in sources
viewport: {
viewports: MINIMAL_VIEWPORTS,
},
options: {
storySort: {
order: ['Landing', '*'],
},
},
},
globalTypes: {
theme: {
defaultValue: 'light',
toolbar: {
title: 'Theme',
icon: 'mirror',
items: [
{value: 'light', right: '☼', title: 'Light'},
{value: 'dark', right: '☾', title: 'Dark'},
{value: 'light-hc', right: '☼', title: 'High Contrast Light (beta)'},
{value: 'dark-hc', right: '☾', title: 'High Contrast Dark (beta)'},
],
},
},
lang: {
defaultValue: 'en',
toolbar: {
title: 'Language',
icon: 'globe',
items: [
{value: 'en', right: '🇬🇧', title: 'En'},
{value: 'ru', right: '🇷🇺', title: 'Ru'},
],
},
},
},
};

export default preview;
41 changes: 41 additions & 0 deletions .storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {create} from '@storybook/theming';

export const ThemeLight = create({
base: 'light',

colorPrimary: '#027bf3',
colorSecondary: 'rgba(2, 123, 243, 0.6)',

// Typography
fontBase: '"Helvetica Neue", Arial, Helvetica, sans-serif',
fontCode:
'"SF Mono", "Menlo", "Monaco", "Consolas", "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", "Courier", monospace',

// Text colors
textColor: 'black',
textInverseColor: 'black',

// Toolbar default and active colors
barTextColor: 'silver',
barSelectedColor: '#027bf3',
// barBg: '#027bf3',

// Form colors
inputBg: 'white',
inputBorder: 'silver',
inputTextColor: 'black',
inputBorderRadius: 4,

brandUrl: 'https://github.com/gravity-ui/landing',
brandTitle: `<div style="font-size: 18px; color: #027bf3; font-weight: 600; margin-top: -6px; margin-bottom: 2px;">Landing</div>
<div style="font-size: 14px;color: #7d7d7d;font-weight: 400;">Landing</div>`,
});

export const ThemeDark = create({
base: 'dark',
});

export const themes = {
light: ThemeLight,
dark: ThemeDark,
};
8 changes: 8 additions & 0 deletions .storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"target": "ES2017"
},
"include": ["src/**/*", "demo/**/*"],
}
5 changes: 5 additions & 0 deletions demo/Landing.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {Meta} from '@storybook/react';

export default {
title: 'Landing / Landing example',
} as Meta;
Loading
Loading