Apply twJoin, twMerge

Looking at https://github.com/dcastil/tailwind-merge/blob/v1.13.1/docs/when-and-how-to-use-it.md#how-to-use-it I placed the "winning" class at the end for twMerge
This commit is contained in:
Tobias 2023-06-15 05:38:52 +02:00
parent 9c96f6534f
commit b55d976492
16 changed files with 52 additions and 43 deletions

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from "svelte"
import { twJoin, twMerge } from "tailwind-merge"
import BaseUIElement from "../BaseUIElement"
import Img from "./Img"
@ -8,11 +9,11 @@
export let newTab = false
export let options: {
imgSize?: string
// extraClasses?: string
extraClasses?: string
} = {}
let imgElem: HTMLElement
let imgClasses = "block justify-center shrink-0 mr-4 " + (options?.imgSize ?? "h-11 w-11")
let imgClasses = twJoin("block justify-center shrink-0 mr-4", options?.imgSize ?? "h-11 w-11")
onMount(() => {
// Image
@ -30,7 +31,7 @@
</script>
<a
class={(options.extraClasses ?? "") + " button text-ellipsis"}
class={twMerge(options.extraClasses, "button text-ellipsis")}
{href}
target={newTab ? "_blank" : undefined}
>