Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-views-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@evo-web/marko": patch
---

Refactor evo-card
22 changes: 12 additions & 10 deletions packages/evo-marko/src/tags/evo-card/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ export interface Input extends Omit<Marko.HTML.Span, "title"> {
...htmlInput
}=input>

<const/[tagName, extraAttrs]=((): [string, Marko.HTML.A | Marko.HTML.Button] => {
if (action) {
return ["span", {}];
} else if (href) {
return ["a", { href: disabled ? "" : href }];
} else {
return ["button", { type: "button", disabled }];
}
})()>
<define/Root|input: (Marko.HTML.Span | Marko.HTML.A | Marko.HTML.Button)|>
<if=action>
<span ...(input as Marko.HTML.Span)/>
</if>
<else if=href>
<a ...(input as Marko.HTML.A) href=disabled ? "" : href/>
</else>
<else>
<button ...(input as Marko.HTML.Button) type="button" disabled=disabled/>
</else>
</define>

<${tagName} ...htmlInput ...extraAttrs class=[
<Root ...htmlInput class=[
"card",
aspectRatio === "5:4" && "card--aspect-5-4",
aspectRatio === "16:9" && "card--aspect-16-9",
Expand Down