Skip to content

Commit

Permalink
feat: add classNames common function
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor committed Nov 5, 2020
1 parent 33103ac commit 56886e8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/common/className.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ import { APP_PREFIX } from 'mo/common/const';
export function prefixClaName(name: string, prefix: string = APP_PREFIX ) {
return name ? `${prefix}-${name}` : '';
}

export function classNames(...names) {
return names.filter((name) => !!name).join(' ');
}
3 changes: 1 addition & 2 deletions src/components/collapse/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';

import './style.scss';
import { prefixClaName } from 'mo/common/className';
import { prefixClaName, classNames } from 'mo/common/className';

interface ICollapseProps {
className?: string;
Expand Down
3 changes: 1 addition & 2 deletions src/components/tree/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import RcTree from 'rc-tree';
import classNames from 'classnames';

import './style.scss';
import { prefixClaName } from 'mo/common/className';
import { prefixClaName, classNames } from 'mo/common/className';

export interface ITree {

Expand Down
3 changes: 1 addition & 2 deletions src/workbench/workbench.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import './style.scss';
import * as React from 'react';
import classNames from 'classnames';
import { Utils } from 'dt-utils';
import SplitPane from 'react-split-pane';
import { prefixClaName } from 'mo/common/className';
import { classNames, prefixClaName } from 'mo/common/className';
import { APP_PREFIX } from 'mo/common/const';

import { EditorView } from 'mo/workbench/editor';
Expand Down

0 comments on commit 56886e8

Please sign in to comment.