Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix 404 when clicking on "Date Range Field" DemoContainer #894

Merged
merged 1 commit into from
May 6, 2024

Conversation

jxjj
Copy link
Contributor

@jxjj jxjj commented May 6, 2024

On the home page, when a user clicks on a demo container with a title containing more than two words, they will get a 404.

For example, "Date Range Picker" generates the link: /components/date-range%20picker.html rather than the correct link /components/date-range-picker.html.

The component responsible for generating this url is <DemoContainer>. It uses the title prop to generate the link. When a title has a space, it currently substitutes a hyphen for the space using title.replace(" ", "-").

However, .replace() only replaces the first instance when passed a string as the pattern, so only the first " " is replaced with a "-".

This updates to use a regex in title.replace() so that each instance of whitespace is replaced with a hyphen.

Resolves #893

On the home page, when a user clicks on a demo container with a title
containing more than two words, they will get a 404.

For example, "Date Range Picker" generates the link:
`/components/date-range%20picker.html` rather than the correct link
`/components/date-range%20picker.html`.

The component responsible for generating this url is `<DemoContainer>`. It
uses the `title` prop to generate the link. When a title has a space, it currently
substitutes a hyphen for the space using `title.replace(" ", "-")`.

However, `.replace()` only replaces the first instance when passed a string as
the pattern, so only the first `" "` is replaced with a `"-"`.

This updates to use a regex in `title.replace()` so that each instance of
whitespace is replaced with a hyphen.
@zernonia
Copy link
Member

zernonia commented May 6, 2024

Thanks for the issue and fix @jxjj ! 😁

@zernonia zernonia merged commit 91e4148 into unovue:main May 6, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs]: Clicking on Date Range Picker gives 404
2 participants