增加Scheme展示承载和模式切换页面。
This commit is contained in:
parent
dfc750dba2
commit
db2da9bd84
16
src/page-components/scheme/SchemeView.module.css
Normal file
16
src/page-components/scheme/SchemeView.module.css
Normal file
|
@ -0,0 +1,16 @@
|
|||
@layer pages {
|
||||
.scheme_view_layout {
|
||||
flex: 1 0;
|
||||
width: 100%;
|
||||
padding: calc(var(--spacing) * 4) calc(var(--spacing) * 8);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
.preview_switch_container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
}
|
23
src/page-components/scheme/SchemeView.tsx
Normal file
23
src/page-components/scheme/SchemeView.tsx
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { useState } from 'react';
|
||||
import { Switch } from '../../components/Switch';
|
||||
import { SchemeSet } from '../../stores/schemes';
|
||||
import { SchemeContent } from './SchemeContent';
|
||||
import styles from './SchemeView.module.css';
|
||||
|
||||
type SchemeViewProps = {
|
||||
scheme: SchemeSet['lightScheme' | 'darkScheme'];
|
||||
};
|
||||
|
||||
export function SchemeView({ scheme }: SchemeViewProps) {
|
||||
const [enablePreview, setEnablePreview] = useState(false);
|
||||
|
||||
return (
|
||||
<div className={styles.scheme_view_layout}>
|
||||
<div className={styles.preview_switch_container}>
|
||||
<span>Preview scheme</span>
|
||||
<Switch onChange={(checked) => setEnablePreview(checked)} />
|
||||
</div>
|
||||
{enablePreview ? <div>SVG Preview</div> : <SchemeContent scheme={scheme} />}
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user