Skip to content

Commit

Permalink
💄 style(leva-panel): 添加 style 与 className 属性
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 14, 2023
1 parent a47c63f commit b0920fe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/LevaPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createStyles } from 'antd-style';
import { LevaPanel, LevaStoreProvider, useCreateStore } from 'leva';
import { ReactNode, memo } from 'react';
import { CSSProperties, ReactNode, memo } from 'react';
import Schema, { SchemaProps } from './Schema';

const useStyles = createStyles(
Expand All @@ -21,8 +21,7 @@ const useStyles = createStyles(
--leva-fonts-mono: ${token.fontFamilyCode};
overflow: auto;
width: 100%;
height: 100%;
padding: 6px 0;
> div {
Expand All @@ -45,15 +44,17 @@ const useStyles = createStyles(

export interface LevaPanelProps<T> extends SchemaProps<T> {
title?: ReactNode;
className?: string;
style?: CSSProperties;
}

const Panel: <T>(props: LevaPanelProps<T>) => ReactNode = memo(
({ value, title, onChange, schema }) => {
({ value, title, onChange, schema, className, style }) => {
const store = useCreateStore();
const { styles } = useStyles();
const { styles, cx } = useStyles();

return (
<div className={styles}>
<div className={cx(styles, className)} style={style}>
<LevaPanel
hideCopyButton
neverHide
Expand Down

0 comments on commit b0920fe

Please sign in to comment.