Skip to content

Commit

Permalink
initial example selection is now case-insensitive
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Deubler <[email protected]>
  • Loading branch information
TerminalTim committed May 14, 2024
1 parent b580b7a commit 7b3a518
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -182,7 +183,7 @@ export const App: React.FC = (props: { examples: any }) => {

return (<div className={'Playground'}>
<Navbar title={'XYZ Maps Playground'} version={apiVersion}></Navbar>
<MobilePanel defaultActive={'editor'} onChange={handleVisibility} visibility={visibility}/>
<MobilePanel defaultActive={'editor'} onChange={handleVisibility} visibility={visibility} />

<div className={'content'}>
<ExampleList examples={props.examples} onSelect={selectExample} onResize={updateColumnSize}
Expand Down

0 comments on commit 7b3a518

Please sign in to comment.