锯木厂
Graylog通用设计系统. 这个软件包提供了mantine(SawmillMantine)和有风格的组件(SawmillSC)主题.
使用锯木机
安装软件包
$ yarn add @graylog/sawmill
字体配置
软件包安装后,您需要调整样式化组件类型声明 @types/styled-components/index.d.ts,如果您需要使用有样式的部件锯木厂(SawmillSC):
import 'styled-components';
import type { StyledComponentsTheme } from '@graylog/sawmill/styled-components';
declare module 'styled-components' {
export interface DefaultTheme extends StyledComponentsTheme {}
}
设置主题提供者
每个锯木厂为相关主题提供者提供主题:
import SawmillMantine from '@graylog/sawmill/mantine';
import type { ColorScheme } from '@graylog/sawmill';
const AppThemeProvider = ({ children }: React.PropsWithChildren<{}>) => {
const [colorScheme, setColorScheme] = useState<ColorScheme>(DEFAULT_THEME_MODE);
const mantineTheme = useMemo(
() => SawmillMantine({ colorScheme }),
[colorScheme],
);
return <MantineProvider theme={mantineTheme}>{children}</MantineProvider>
}
导入字体
要导入锯木厂主题中定义的字体, 请包括 import '@graylog/sawmill/fonts' 在你的项目.
作出改变
风格的构件和曼汀锯木厂的基础就是 THEME_BASE.ts 文档.
当你改变这个主题基础时,你需要运行 yarn generate-themes 生成每个锯木厂的主题.
建设图书馆
要建立您需要运行的图书馆 :
$ yarn build # Compile source with tsc and generate `dist` files.
本地测试更改
当您想要在本地测试更改时, 您需要临时添加本地寄存器, 作为您项目的依赖 :
yarn add file:/path/to/this/project