-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.d.ts
46 lines (36 loc) · 1.03 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
Conditionally join CSS class names together.
@param input - Accepts a combination of strings and objects. When an object, only object keys with truthy values are included. Anything else is ignored.
@example
```
import classNames from '@sindresorhus/class-names';
classNames('unicorn', 'rainbow');
//=> 'unicorn rainbow'
classNames({awesome: true, foo: false}, 'unicorn', {rainbow: false});
//=> 'awesome unicorn'
classNames('unicorn', null, undefined, 0, 1, {foo: null});
//=> 'unicorn'
const buttonType = 'main';
classNames({[`button-${buttonType}`]: true});
//=> 'button-main'
const Button = props => {
console.log(props);
// {
// type: 'success',
// small: true
// }
const buttonClass = classNames(
'button',
{
[`button-${props.type}`]: props.type,
'button-block': props.block,
'button-small': props.small
}
);
console.log(buttonClass);
//=> 'button button-success button-small'
return <button className={buttonClass}>…</button>;
};
```
*/
export default function classNames(...input: unknown[]): string;