Skip to content

Commit 1f6d940

Browse files
committed
fix: modify className name.
1 parent b7ae1c0 commit 1f6d940

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

core/README.md

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -368,34 +368,25 @@ const object = {
368368
}
369369

370370
const Arrow = (props) => {
371-
const { style, 'data-expand': expand, ...reset } = props;
372-
const defaultStyle = {
373-
cursor: 'pointer',
374-
height: '1em',
375-
width: '1em',
376-
};
371+
const { style, 'data-expand': expand, ...reset } = props;
372+
const svgProps = {
373+
style: { cursor: 'pointer', height: '1em', width: '1em' },
374+
viewBox: '0 0 24 24',
375+
fill: 'var(--w-rjv-arrow-color, currentColor)',
376+
...reset
377+
}
377378
if (!expand) {
378379
return (
379-
<svg
380-
viewBox="0 0 24 24"
381-
fill="var(--w-rjv-arrow-color, currentColor)"
382-
style={defaultStyle}
383-
{...reset}
384-
>
380+
<svg {...svgProps}>
385381
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z" />
386382
</svg>
387-
)
383+
);
388384
}
389385
return (
390-
<svg
391-
viewBox="0 0 24 24"
392-
fill="var(--w-rjv-arrow-color, currentColor)"
393-
style={defaultStyle}
394-
{...reset}
395-
>
386+
<svg {...svgProps}>
396387
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7" />
397388
</svg>
398-
)
389+
);
399390
}
400391

401392
export default function Demo() {

core/src/node.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const CountInfo: FC<PropsWithChildren<LabelProps>> = ({ children }) => (
7272
<Label
7373
style={{ paddingLeft: 4, fontStyle: 'italic' }}
7474
color="var(--w-rjv-info-color, #0000004d)"
75-
className="object-size"
75+
className="w-rjv-object-size"
7676
>
7777
{children}
7878
</Label>
@@ -130,9 +130,9 @@ export function RooNode<T extends object>(props: RooNodeProps<T>) {
130130
} as ValueViewProps<T>;
131131

132132
const arrowView = components.arrow ? (
133-
cloneElement(components.arrow, { style: arrowStyle, 'data-expand': expand })
133+
cloneElement(components.arrow, { style: arrowStyle, 'data-expand': expand, className: "w-rjv-arrow" })
134134
) : (
135-
<TriangleArrow style={arrowStyle} />
135+
<TriangleArrow style={arrowStyle} className="w-rjv-arrow" />
136136
);
137137
const [showTools, setShowTools] = useState(false);
138138
const tools = enableClipboard ? <Copied show={showTools} text={value as T} render={components.copied} /> : undefined;
@@ -142,7 +142,7 @@ export function RooNode<T extends object>(props: RooNodeProps<T>) {
142142
eventProps.onMouseLeave = () => setShowTools(false);
143143
}
144144
return (
145-
<div {...reset} {...eventProps}>
145+
<div {...reset} className="w-rjv-inner" {...eventProps}>
146146
<Line style={{ display: 'inline-flex', alignItems: 'center' }} onClick={handle}>
147147
{arrowView}
148148
{(typeof keyName === 'string' || typeof keyName === 'number') && (
@@ -166,7 +166,7 @@ export function RooNode<T extends object>(props: RooNodeProps<T>) {
166166
{tools}
167167
</Line>
168168
{expand && (
169-
<Line style={{ borderLeft: 'var(--w-rjv-border-left-width, 1px) solid var(--w-rjv-line-color, #ebebeb)', marginLeft: 6 }}>
169+
<Line className="w-rjv-content" style={{ borderLeft: 'var(--w-rjv-border-left-width, 1px) solid var(--w-rjv-line-color, #ebebeb)', marginLeft: 6 }}>
170170
{nameKeys.length > 0 &&
171171
nameKeys.map((key, idx) => {
172172
const item = value[key];
@@ -185,14 +185,14 @@ export function RooNode<T extends object>(props: RooNodeProps<T>) {
185185
if (Array.isArray(item) && !isEmpty) {
186186
const label = isArray ? idx : key;
187187
return (
188-
<Line key={label + idx}>
188+
<Line key={label + idx} className="w-rjv-wrap">
189189
<RooNode value={item} keyid={keyid + subkeyid + label} keyName={label} {...subNodeProps} />
190190
</Line>
191191
);
192192
}
193193
if (typeof item === 'object' && item && !((item as any) instanceof Date) && !isEmpty) {
194194
return (
195-
<Line key={key + idx}>
195+
<Line key={key + idx} className="w-rjv-wrap">
196196
<RooNode keyid={keyid + subkeyid + key} value={item} keyName={key} {...subNodeProps} />
197197
</Line>
198198
);

core/src/value.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export function ValueView<T = object>(props: ValueViewProps<T>) {
112112

113113
const [showTools, setShowTools] = useState(false);
114114
const tools = enableClipboard ? <Copied show={showTools} text={value} /> : undefined;
115-
const eventProps: React.HTMLAttributes<HTMLDivElement> = {};
115+
const eventProps: React.HTMLAttributes<HTMLDivElement> = {
116+
className: 'w-rjv-line',
117+
style: { paddingLeft: indentWidth },
118+
};
116119
if (enableClipboard) {
117120
eventProps.onMouseEnter = () => setShowTools(true);
118121
eventProps.onMouseLeave = () => setShowTools(false);
@@ -132,7 +135,7 @@ export function ValueView<T = object>(props: ValueViewProps<T>) {
132135
</Label>
133136
);
134137
return (
135-
<Line style={{ paddingLeft: indentWidth }} {...eventProps}>
138+
<Line {...eventProps}>
136139
<Label {...reset}>
137140
{renderKey}
138141
<Colon />
@@ -152,7 +155,7 @@ export function ValueView<T = object>(props: ValueViewProps<T>) {
152155
</Fragment>
153156
)
154157
return (
155-
<Line style={{ paddingLeft: indentWidth }} {...eventProps}>
158+
<Line {...eventProps}>
156159
<Label {...reset}>
157160
{renderKey}
158161
<Colon />

0 commit comments

Comments
 (0)