From 7b3a518e04615248f222cf93a7cd5f2e754db273 Mon Sep 17 00:00:00 2001 From: Tim Deubler Date: Tue, 14 May 2024 11:36:17 +0200 Subject: [PATCH] initial example selection is now case-insensitive Signed-off-by: Tim Deubler --- packages/playground/src/App.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/playground/src/App.tsx b/packages/playground/src/App.tsx index f16c82a2d..8e865dbda 100644 --- a/packages/playground/src/App.tsx +++ b/packages/playground/src/App.tsx @@ -121,10 +121,11 @@ export const App: React.FC = (props: { examples: any }) => { if (hash) { let [c, title] = hash.split('-'); if (title) { - c = decodeURI(c); - title = title.replace(/_/g, ' '); + // capitalize + c = decodeURI(c).split(' ').map((w) => w[0].toUpperCase() + w.slice(1)).join(' '); + title = title.replace(/_/g, ' ').toLowerCase(); for (let i = 0, examples = props.examples[c]; i < examples.length; i++) { - if (examples[i].title == title) { + if (examples[i].title.toLowerCase() == title) { initExample = [i, c]; break; } @@ -182,7 +183,7 @@ export const App: React.FC = (props: { examples: any }) => { return (
- +