mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-22 19:11:32 +03:00
4b6c4ed546
fix AF-1454 1. move inline tags editor to components 2. add progress component 3. adjust doc properties styles for desktop 4. subscribe bs database links and display in doc info 5. move update/create dates to doc info 6. a trivial e2e test <div class='graphite__hidden'> <div>🎥 Video uploaded on Graphite:</div> <a href="https://app.graphite.dev/media/video/T2klNLEk0wxLh4NRDzhk/eed266c1-fdac-4f0e-baa9-4aa00d14a2e8.mp4"> <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/T2klNLEk0wxLh4NRDzhk/eed266c1-fdac-4f0e-baa9-4aa00d14a2e8.mp4"> </a> </div> <video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/eed266c1-fdac-4f0e-baa9-4aa00d14a2e8.mp4">10月23日.mp4</video>
68 lines
1.6 KiB
TypeScript
68 lines
1.6 KiB
TypeScript
import { getOrCreateI18n, I18nextProvider } from '@affine/i18n';
|
|
import { ThemeProvider } from 'next-themes';
|
|
import type { ComponentType } from 'react';
|
|
import '../src/theme';
|
|
import './polyfill';
|
|
import './preview.css';
|
|
|
|
import type { Preview } from '@storybook/react';
|
|
import React, { useEffect } from 'react';
|
|
import { ConfirmModalProvider } from '../src/ui/modal/confirm-modal';
|
|
|
|
import { setupGlobal } from '@affine/env/global';
|
|
import { useTheme as useNextTheme } from 'next-themes';
|
|
|
|
setupGlobal();
|
|
|
|
export const parameters: Preview = {
|
|
argTypes: {
|
|
param: {
|
|
table: { category: 'Group' },
|
|
},
|
|
},
|
|
};
|
|
export const globalTypes = {
|
|
theme: {
|
|
description: 'Global theme for components',
|
|
defaultValue: 'light',
|
|
toolbar: {
|
|
title: 'theme',
|
|
icon: 'circlehollow',
|
|
dynamic: true,
|
|
items: [
|
|
{ value: 'light', title: 'Light', icon: 'sun' },
|
|
{ value: 'dark', title: 'Dark', icon: 'moon' },
|
|
],
|
|
},
|
|
},
|
|
};
|
|
|
|
const ThemeToggle = ({ context }) => {
|
|
const { theme } = context.globals;
|
|
const { setTheme } = useNextTheme();
|
|
|
|
useEffect(() => {
|
|
setTheme(theme);
|
|
}, [theme]);
|
|
|
|
return null;
|
|
};
|
|
|
|
const i18n = getOrCreateI18n();
|
|
|
|
export const decorators = [
|
|
(Story: ComponentType, context) => {
|
|
return (
|
|
<ThemeProvider themes={['dark', 'light']} enableSystem={true}>
|
|
<ThemeToggle context={context} />
|
|
<I18nextProvider i18n={i18n}>
|
|
<ConfirmModalProvider>
|
|
<Story {...context} />
|
|
</ConfirmModalProvider>
|
|
</I18nextProvider>
|
|
</ThemeProvider>
|
|
);
|
|
},
|
|
];
|
|
export const tags = ['autodocs'];
|