Skip to content

Commit

Permalink
refactor(components): render Chat inside App
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Nov 16, 2024
1 parent b747e63 commit e1af04c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<main
class="mx-auto h-fit h-screen w-full max-w-screen-xl place-content-center sm:w-96"
id="root"
id="app"
></main>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
9 changes: 9 additions & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Chat from './Chat';

export default function App() {
return (
<section class="flex h-screen flex-col rounded-xl bg-white sm:h-[70vh] sm:border sm:shadow">
<Chat />
</section>
);
}
4 changes: 2 additions & 2 deletions src/components/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Chat() {
});

return (
<section class="flex h-screen flex-col rounded-xl bg-white sm:h-[70vh] sm:border sm:shadow">
<>
<Header />
<ChatError error={error} reload={reload} />
<Messages messages={messages} />
Expand All @@ -48,6 +48,6 @@ export default function Chat() {
onSubmit={handleSubmit}
value={input}
/>
</section>
</>
);
}
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import './index.css';

import { render } from 'preact';

import Chat from './components/Chat';
import App from './components/App';

render(<Chat />, document.getElementById('root')!);
render(<App />, document.getElementById('app')!);

0 comments on commit e1af04c

Please sign in to comment.