mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 19:01:05 +00:00
feat: initial commit
This commit is contained in:
parent
bde7dd644f
commit
72dc38ea56
119 changed files with 14925 additions and 1 deletions
19
src/lib/cx.js
Normal file
19
src/lib/cx.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const prefix = 'bx';
|
||||
|
||||
function cx(...items) {
|
||||
const classes = [];
|
||||
|
||||
items.forEach(item => {
|
||||
if (typeof item === 'string') {
|
||||
if (item.slice(0, 2) === '--') {
|
||||
classes.push(`${prefix}${item}`);
|
||||
} else {
|
||||
classes.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return classes.join(' ');
|
||||
}
|
||||
|
||||
export { cx };
|
1
src/lib/index.js
Normal file
1
src/lib/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export { cx } from './cx';
|
Loading…
Add table
Add a link
Reference in a new issue