-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add
react-component-tsx
example.
- Loading branch information
1 parent
7bd60b8
commit 305cc2a
Showing
32 changed files
with
455 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Basic Example for react-router-ts | ||
=== | ||
|
||
Use [`react-router`](https://github.com/remix-run/react-router) for the project. | ||
|
||
## Quick Start | ||
|
||
```bash | ||
$ npx create-kkt my-app -e react-router-ts | ||
cd my-app | ||
npm install | ||
``` | ||
|
||
**development** | ||
|
||
Runs the project in development mode. | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
**production** | ||
|
||
Builds the app for production to the build folder. | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
The build is minified and the filenames include the hashes. | ||
Your app is ready to be deployed! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "@template/react-router-ts", | ||
"version": "7.5.3", | ||
"private": true, | ||
"dependencies": { | ||
"react": "~18.2.0", | ||
"react-dom": "~18.2.0", | ||
"react-router-dom": "^6.16.0", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^6.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.0.0", | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^16.18.58", | ||
"@types/react": "^18.2.28", | ||
"@types/react-dom": "^18.2.13", | ||
"kkt": "^7.5.3" | ||
}, | ||
"scripts": { | ||
"start": "kkt start", | ||
"build": "kkt build", | ||
"test": "kkt test --env=jsdom", | ||
"coverage": "kkt test --env=jsdom --coverage" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using KKT" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { forwardRef, PropsWithoutRef } from 'react'; | ||
import { useRouteError } from 'react-router-dom'; | ||
|
||
export interface ErrorPageProps extends React.HTMLAttributes<HTMLDivElement> {} | ||
|
||
export const ErrorPage = forwardRef<HTMLDivElement, PropsWithoutRef<ErrorPageProps>>( | ||
({ children, ...htmlProps }, ref) => { | ||
const error = useRouteError() as Response; | ||
return ( | ||
<div id="error-page" {...htmlProps} ref={ref}> | ||
<h1>Oops!</h1> | ||
<p>Sorry, an unexpected error occurred.</p> | ||
<p> | ||
{error?.status && <em>{error?.status}</em>} | ||
{error?.statusText && <i>{decodeURI(error?.statusText || '')}</i>} | ||
</p> | ||
</div> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import React from 'react'; | ||
|
||
export interface FallbackProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {} | ||
const defaultStyle: React.CSSProperties = { | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
gap: '1rem', | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
bottom: 0, | ||
position: 'absolute', | ||
zIndex: 9999, | ||
}; | ||
|
||
export const Fallback = ({ children, style, ...other }: FallbackProps) => ( | ||
<div {...other} style={{ ...defaultStyle, ...style }}> | ||
<svg width="25" height="30" viewBox="0 0 135 140" fill="currentColor"> | ||
<rect y="10" width="15" height="120" rx="6"> | ||
<animate | ||
attributeName="height" | ||
begin="0.5s" | ||
dur="1s" | ||
values="120;110;100;90;80;70;60;50;40;140;120" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
<animate | ||
attributeName="y" | ||
begin="0.5s" | ||
dur="1s" | ||
values="10;15;20;25;30;35;40;45;50;0;10" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
</rect> | ||
<rect x="30" y="10" width="15" height="120" rx="6"> | ||
<animate | ||
attributeName="height" | ||
begin="0.25s" | ||
dur="1s" | ||
values="120;110;100;90;80;70;60;50;40;140;120" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
<animate | ||
attributeName="y" | ||
begin="0.25s" | ||
dur="1s" | ||
values="10;15;20;25;30;35;40;45;50;0;10" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
</rect> | ||
<rect x="60" width="15" height="140" rx="6"> | ||
<animate | ||
attributeName="height" | ||
begin="0s" | ||
dur="1s" | ||
values="120;110;100;90;80;70;60;50;40;140;120" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
<animate | ||
attributeName="y" | ||
begin="0s" | ||
dur="1s" | ||
values="10;15;20;25;30;35;40;45;50;0;10" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
</rect> | ||
<rect x="90" y="10" width="15" height="120" rx="6"> | ||
<animate | ||
attributeName="height" | ||
begin="0.25s" | ||
dur="1s" | ||
values="120;110;100;90;80;70;60;50;40;140;120" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
<animate | ||
attributeName="y" | ||
begin="0.25s" | ||
dur="1s" | ||
values="10;15;20;25;30;35;40;45;50;0;10" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
</rect> | ||
<rect x="120" y="10" width="15" height="120" rx="6"> | ||
<animate | ||
attributeName="height" | ||
begin="0.5s" | ||
dur="1s" | ||
values="120;110;100;90;80;70;60;50;40;140;120" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
<animate | ||
attributeName="y" | ||
begin="0.5s" | ||
dur="1s" | ||
values="10;15;20;25;30;35;40;45;50;0;10" | ||
calcMode="linear" | ||
repeatCount="indefinite" | ||
/> | ||
</rect> | ||
</svg> | ||
<div>{children || 'Loading...'}</div> | ||
</div> | ||
); |
Oops, something went wrong.