Skip to content

Commit fad41ca

Browse files
authored
Fixing paths in GitHub Pages (#53)
* gh-pagesはリポジトリ名がパスに含まれる * replaceにも/react-hooks-use-modalを含める
1 parent 5c64a59 commit fad41ca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/src/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { Modal as CloseButtonWithRenderOptionModal } from './js/close-button/ren
77
import { ModalWrapper as ModalConfigModal } from './js/modal-config';
88

99
const CurrentModal = () => {
10-
switch (window.location.pathname.replace(/\/$/, '')) {
10+
switch (
11+
window.location.pathname
12+
.replace(/^\/react-hooks-use-modal/, '')
13+
.replace(/\/$/, '')
14+
) {
1115
case '/close-button': {
1216
return <CloseButtonModal />;
1317
}
@@ -35,7 +39,10 @@ const Wrapper = ({ children }: PropsWithChildren<{}>) => {
3539
{children}
3640
<nav style={{ marginTop: '40px' }}>
3741
{routes.map((route, i) => (
38-
<a href={route} style={{ marginLeft: i !== 0 ? '10px' : '' }}>
42+
<a
43+
href={`/react-hooks-use-modal${route}`}
44+
style={{ marginLeft: i !== 0 ? '10px' : '' }}
45+
>
3946
{route}
4047
</a>
4148
))}

0 commit comments

Comments
 (0)