Skip to content

Commit 56886e8

Browse files
committed
feat: add classNames common function
1 parent 33103ac commit 56886e8

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/common/className.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ import { APP_PREFIX } from 'mo/common/const';
1010
export function prefixClaName(name: string, prefix: string = APP_PREFIX ) {
1111
return name ? `${prefix}-${name}` : '';
1212
}
13+
14+
export function classNames(...names) {
15+
return names.filter((name) => !!name).join(' ');
16+
}

src/components/collapse/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react';
22
import RcCollapse from 'rc-collapse';
3-
import classNames from 'classnames';
43

54
import './style.scss';
6-
import { prefixClaName } from 'mo/common/className';
5+
import { prefixClaName, classNames } from 'mo/common/className';
76

87
interface ICollapseProps {
98
className?: string;

src/components/tree/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react';
22
import RcTree from 'rc-tree';
3-
import classNames from 'classnames';
43

54
import './style.scss';
6-
import { prefixClaName } from 'mo/common/className';
5+
import { prefixClaName, classNames } from 'mo/common/className';
76

87
export interface ITree {
98

src/workbench/workbench.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import './style.scss';
22
import * as React from 'react';
3-
import classNames from 'classnames';
43
import { Utils } from 'dt-utils';
54
import SplitPane from 'react-split-pane';
6-
import { prefixClaName } from 'mo/common/className';
5+
import { classNames, prefixClaName } from 'mo/common/className';
76
import { APP_PREFIX } from 'mo/common/const';
87

98
import { EditorView } from 'mo/workbench/editor';

0 commit comments

Comments
 (0)