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 { export interface Props {
name: string; name: string;
size?: "sm" | "lg"; size?: "sm" | "lg";
@@ -6,11 +8,7 @@ export interface Props {
const { name, size = "sm" } = Astro.props; const { name, size = "sm" } = Astro.props;
const slug = ((str: string) => const slug = slugify(name);
str
.toLowerCase()
.replace(/ /g, "-")
.replace(/[^\w-]+/g, ""))(name);
--- ---
<li class="inline-block my-1"> <li class="inline-block my-1">