Replace internal slug codes with slugify function

This commit is contained in:
Sat Naing
2022-09-11 14:06:58 +06:30
parent 831999ca17
commit f4c80166de
+3 -5
View File
@@ -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);
---
<li class="inline-block my-1">