2023-04-05 12:48:38 +00:00
|
|
|
import React from 'react'
|
2023-04-11 18:52:18 +00:00
|
|
|
import type { Preview } from '@storybook/react'
|
2024-09-25 15:17:58 +00:00
|
|
|
import { customisation } from '@status-im/colors'
|
2023-02-14 16:36:38 +00:00
|
|
|
import './reset.css'
|
|
|
|
|
2023-04-11 18:52:18 +00:00
|
|
|
const preview: Preview = {
|
2024-09-25 15:17:58 +00:00
|
|
|
globalTypes: {
|
|
|
|
customisation: {
|
|
|
|
toolbar: {
|
|
|
|
title: 'Customisation',
|
|
|
|
// icon: 'paintbrush',
|
|
|
|
defaultValue: 'blue',
|
|
|
|
items: Object.keys(customisation),
|
|
|
|
dynamicTitle: true,
|
|
|
|
defaultItem: 'army',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-04-11 18:52:18 +00:00
|
|
|
parameters: {
|
|
|
|
// layout: 'centered',
|
2024-09-25 15:17:58 +00:00
|
|
|
customisation: {
|
|
|
|
default: 'blue',
|
|
|
|
values: [
|
|
|
|
{ name: 'blue', value: '#0000ff' },
|
|
|
|
{ name: 'red', value: '#ff0000' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
backgrounds: {
|
|
|
|
default: 'light',
|
|
|
|
values: [
|
|
|
|
{ name: 'light', value: '#fff' },
|
|
|
|
{ name: 'dark', value: '#0D1625' },
|
|
|
|
],
|
|
|
|
},
|
2023-01-13 14:52:08 +00:00
|
|
|
},
|
2024-09-25 15:17:58 +00:00
|
|
|
|
2023-04-11 18:52:18 +00:00
|
|
|
decorators: [
|
2024-09-25 15:17:58 +00:00
|
|
|
(Story, context) => {
|
|
|
|
document.body.setAttribute(
|
|
|
|
'data-theme',
|
|
|
|
context.parameters.backgrounds?.default === 'dark' ? 'dark' : 'light',
|
2023-04-11 18:52:18 +00:00
|
|
|
)
|
2024-09-25 15:17:58 +00:00
|
|
|
|
|
|
|
document.body.setAttribute(
|
|
|
|
'data-customisation',
|
|
|
|
context.globals.customisation ?? 'blue',
|
|
|
|
)
|
|
|
|
|
|
|
|
return <Story />
|
2023-04-11 18:52:18 +00:00
|
|
|
},
|
|
|
|
],
|
2023-01-10 11:24:24 +00:00
|
|
|
}
|
|
|
|
|
2023-04-11 18:52:18 +00:00
|
|
|
export default preview
|