From f4c80166ded4697090ed4cf0770517c3a37e85d0 Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Sun, 11 Sep 2022 14:06:58 +0630 Subject: [PATCH] Replace internal slug codes with slugify function --- src/components/Tag.astro | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Tag.astro b/src/components/Tag.astro index cdf8d4c..3c22687 100644 --- a/src/components/Tag.astro +++ b/src/components/Tag.astro @@ -1,4 +1,6 @@ --- +import slugify from "src/utils/slugify"; + export interface Props { name: string; size?: "sm" | "lg"; @@ -6,11 +8,7 @@ export interface Props { const { name, size = "sm" } = Astro.props; -const slug = ((str: string) => - str - .toLowerCase() - .replace(/ /g, "-") - .replace(/[^\w-]+/g, ""))(name); +const slug = slugify(name); ---