@@ -80,45 +80,57 @@ export default defineConfig({
8080 directory : {
8181 'main.jsx' : {
8282 file : {
83- contents : `import React from 'react'
84- import ReactDOM from 'react-dom/client'
85- import App from './App'
83+ contents : `import { StrictMode } from 'react'
84+ import { createRoot } from 'react-dom/client'
8685import './index.css'
86+ import App from './App.tsx'
8787
88- ReactDOM. createRoot(document.getElementById('root')).render(
89- <React. StrictMode>
88+ createRoot(document.getElementById('root')).render(
89+ <StrictMode>
9090 <App />
91- </React.StrictMode>,
92- )` ,
91+ </StrictMode>,
92+ )
93+ ` ,
9394 } ,
9495 } ,
9596 'App.jsx' : {
9697 file : {
9798 contents : `import { useState } from 'react'
99+ import reactLogo from './assets/react.svg'
100+ import viteLogo from '/vite.svg'
98101import './App.css'
99102
100103function App() {
101104 const [count, setCount] = useState(0)
102105
103106 return (
104- <div className="App">
107+ <>
108+ <div>
109+ <a href="https://vite.dev" target="_blank">
110+ <img src={viteLogo} className="logo" alt="Vite logo" />
111+ </a>
112+ <a href="https://react.dev" target="_blank">
113+ <img src={reactLogo} className="logo react" alt="React logo" />
114+ </a>
115+ </div>
105116 <h1>Vite + React</h1>
106117 <div className="card">
107118 <button onClick={() => setCount((count) => count + 1)}>
108119 count is {count}
109120 </button>
110121 <p>
111- Edit <code>src/App.jsx </code> and save to test HMR
122+ Edit <code>src/App.tsx </code> and save to test HMR
112123 </p>
113124 </div>
114125 <p className="read-the-docs">
115126 Click on the Vite and React logos to learn more
116127 </p>
117- </div >
128+ </>
118129 )
119130}
120131
121- export default App` ,
132+ export default App
133+ ` ,
122134 } ,
123135 } ,
124136 'App.css' : {
@@ -130,36 +142,48 @@ export default App`,
130142 text-align: center;
131143}
132144
133- .card {
134- padding: 2em;
145+ .logo {
146+ height: 6em;
147+ padding: 1.5em;
148+ will-change: filter;
149+ transition: filter 300ms;
150+ }
151+ .logo:hover {
152+ filter: drop-shadow(0 0 2em #646cffaa);
153+ }
154+ .logo.react:hover {
155+ filter: drop-shadow(0 0 2em #61dafbaa);
135156}
136157
137- button {
138- border-radius: 8px;
139- border: 1px solid transparent;
140- padding: 0.6em 1.2em;
141- font-size: 1em;
142- font-weight: 500;
143- font-family: inherit;
144- background-color: #1a1a1a;
145- cursor: pointer;
146- transition: border-color 0.25s;
158+ @keyframes logo-spin {
159+ from {
160+ transform: rotate(0deg);
161+ }
162+ to {
163+ transform: rotate(360deg);
164+ }
147165}
148166
149- button:hover {
150- border-color: #646cff;
167+ @media (prefers-reduced-motion: no-preference) {
168+ a:nth-of-type(2) .logo {
169+ animation: logo-spin infinite 20s linear;
170+ }
151171}
152172
153- button:focus,
154- button:focus-visible {
155- outline: 4px auto -webkit-focus-ring-color;
156- }` ,
173+ .card {
174+ padding: 2em;
175+ }
176+
177+ .read-the-docs {
178+ color: #888;
179+ }
180+ ` ,
157181 } ,
158182 } ,
159183 'index.css' : {
160184 file : {
161185 contents : `:root {
162- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
186+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
163187 line-height: 1.5;
164188 font-weight: 400;
165189
@@ -173,6 +197,15 @@ button:focus-visible {
173197 -moz-osx-font-smoothing: grayscale;
174198}
175199
200+ a {
201+ font-weight: 500;
202+ color: #646cff;
203+ text-decoration: inherit;
204+ }
205+ a:hover {
206+ color: #535bf2;
207+ }
208+
176209body {
177210 margin: 0;
178211 display: flex;
@@ -184,7 +217,40 @@ body {
184217h1 {
185218 font-size: 3.2em;
186219 line-height: 1.1;
187- }` ,
220+ }
221+
222+ button {
223+ border-radius: 8px;
224+ border: 1px solid transparent;
225+ padding: 0.6em 1.2em;
226+ font-size: 1em;
227+ font-weight: 500;
228+ font-family: inherit;
229+ background-color: #1a1a1a;
230+ cursor: pointer;
231+ transition: border-color 0.25s;
232+ }
233+ button:hover {
234+ border-color: #646cff;
235+ }
236+ button:focus,
237+ button:focus-visible {
238+ outline: 4px auto -webkit-focus-ring-color;
239+ }
240+
241+ @media (prefers-color-scheme: light) {
242+ :root {
243+ color: #213547;
244+ background-color: #ffffff;
245+ }
246+ a:hover {
247+ color: #747bff;
248+ }
249+ button {
250+ background-color: #f9f9f9;
251+ }
252+ }
253+ ` ,
188254 } ,
189255 } ,
190256 } ,
0 commit comments