Comparing version 0.0.20 to 0.0.21
# Smelte changelog | ||
## 0.0.21 | ||
* Fix styles on the data table | ||
* Refactor style function props to accept strings, | ||
eg. `<Button outlinedClasses="bg-transparent border border-solid text-green-500">` means the same as | ||
`<Button outlinedClasses={c => c + " text-green-500">` | ||
## 0.0.20 | ||
@@ -4,0 +10,0 @@ * Fix icons absolute position |
{ | ||
"name": "smelte", | ||
"description": "UI framework for Svelte using Tailwind CSS", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "dev": "sapper dev -p 7777", |
@@ -12,8 +12,12 @@ export default function utils(color, defaultDepth = 500) { | ||
export class ClassBuilder { | ||
constructor() { | ||
this.classes = ""; | ||
constructor(classes, defaultClasses) { | ||
console.log("classes", classes, typeof classes); | ||
this.defaults = | ||
typeof classes === "function" ? classes(defaultClasses) : classes; | ||
this.classes = this.defaults; | ||
} | ||
flush() { | ||
this.classes = ""; | ||
this.classes = this.defaults; | ||
@@ -51,9 +55,15 @@ return this; | ||
add(className, cond = true) { | ||
if (cond && className) { | ||
this.classes += ` ${className} `; | ||
add(className, cond = true, defaultValue) { | ||
if (!cond || !className) return this; | ||
switch (typeof className) { | ||
case "string": | ||
default: | ||
this.classes += ` ${className} `; | ||
return this; | ||
case "function": | ||
this.classes += ` ${className(defaultValue)} `; | ||
return this; | ||
} | ||
return this; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1021011
3291