-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
105 additions
and
87 deletions.
There are no files selected for viewing
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,51 @@ | ||
#container { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100dvw; | ||
height: 100dvh; | ||
background: #242424; | ||
color: white; | ||
border: 1px solid white; | ||
box-sizing: border-box; | ||
} | ||
|
||
.app { | ||
width: 100%; | ||
height: 100%; | ||
max-width: 640px; | ||
max-height: 800px; | ||
box-sizing: border-box; | ||
padding: 12px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: stretch; | ||
} | ||
|
||
.flex { | ||
display: flex; | ||
} | ||
|
||
.expand { | ||
flex: 1; | ||
} | ||
|
||
.filter { | ||
align-self: center; | ||
padding: 20px 0; | ||
} | ||
|
||
.filter-input { | ||
display: flex; | ||
justify-content: space-around; | ||
padding-bottom: 12px; | ||
} | ||
|
||
button { | ||
cursor: pointer; | ||
} | ||
|
||
.todo { | ||
padding: 8px 12px; | ||
border-bottom: 1px solid white; | ||
} |
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,33 @@ | ||
/* | ||
* @since 2024-10-18 23:41:18 | ||
* @author junbao <[email protected]> | ||
*/ | ||
|
||
import { createStore, IDBStorage, withPersist } from 'amos'; | ||
import { Provider } from 'amos/react'; | ||
import { useState } from 'react'; | ||
import { App } from './App'; | ||
import './TodoMVC.css'; | ||
|
||
// For compat with website. | ||
export const TodoMVC = () => { | ||
const [store] = useState(() => { | ||
return createStore( | ||
{ | ||
name: 'Amos - TodoMVC', | ||
devtools: true, | ||
}, | ||
withPersist({ | ||
storage: new IDBStorage('todo', 'todo'), | ||
includes: () => true, | ||
}), | ||
); | ||
}); | ||
return ( | ||
<Provider store={store}> | ||
<div id="container"> | ||
<App /> | ||
</div> | ||
</Provider> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,25 +1,10 @@ | ||
import { createStore, IDBStorage, withPersist } from 'amos'; | ||
import { Provider } from 'amos/react'; | ||
import { StrictMode } from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { App } from './App'; | ||
import { TodoMVC } from './TodoMVC'; | ||
import './index.css'; | ||
|
||
const store = createStore( | ||
{ | ||
name: 'Amos - TodoMVC', | ||
devtools: true, | ||
}, | ||
withPersist({ | ||
storage: new IDBStorage('todo', 'todo'), | ||
includes: () => true, | ||
}), | ||
); | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
<TodoMVC /> | ||
</StrictMode>, | ||
); |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# Examples | ||
|
||
## TodoMVC | ||
|
||
TodoMVC is a classic example through which we demonstrate many commonly used features of Amos, | ||
including SSR, persistence, useQuery, as well as recommended project structure and data structure | ||
design. You can try the project below, view the complete source | ||
code [here](https://github.com/amos-project/amos/tree/main/examples/TodoMVC), or run it directly. | ||
|
||
<iframe width="100%" height="600px" src="/amos/examples/TodoMVC"></iframe> |
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,8 @@ | ||
/* | ||
* @since 2024-11-01 02:24:07 | ||
* @author junbao <[email protected]> | ||
*/ | ||
|
||
import { TodoMVC } from '../../../../examples/TodoMVC/src/TodoMVC'; | ||
|
||
export default TodoMVC; |
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