Skip to content

Commit 692dca0

Browse files
committed
use same slug calculation for building links and routes in gallery apps
1 parent 6f49274 commit 692dca0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pcweb/components/code_card.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
import reflex as rx
24
import reflex_ui as ui
35
from reflex.experimental.client_state import ClientStateVar
@@ -107,6 +109,7 @@ def code_card(app: dict) -> rx.Component:
107109

108110

109111
def gallery_app_card(app: dict[str, str]) -> rx.Component:
112+
slug = re.sub(r"[\s_]+", "-", app["title"]).lower()
110113
return rx.flex(
111114
rx.box(
112115
rx.link(
@@ -116,7 +119,7 @@ def gallery_app_card(app: dict[str, str]) -> rx.Component:
116119
alt="Image preview for app: " + app["title"],
117120
class_name="size-full duration-150 object-cover hover:scale-105 transition-transform ease-out",
118121
),
119-
href=f"/docs/getting-started/open-source-templates/{app['title'].replace(' ', '-').lower()}",
122+
href=f"/docs/getting-started/open-source-templates/{slug}",
120123
),
121124
class_name="relative border-slate-5 border-b border-solid w-full overflow-hidden h-[180px]",
122125
),

0 commit comments

Comments
 (0)