-
Notifications
You must be signed in to change notification settings - Fork 0
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
37 changed files
with
2,143 additions
and
450 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { memo } from 'react' | ||
import { Button } from '@ui' | ||
import store from '@store' | ||
|
||
const AddItem = () => { | ||
const addItem = store(({ addItem }: any) => addItem) | ||
const setText = store(({ setText }: any) => setText) | ||
|
||
const handleAddItem = () => { | ||
console.log('add-------') | ||
addItem() | ||
setText('') | ||
} | ||
|
||
console.log('AddItem') | ||
return ( | ||
<Button | ||
text="Add Item" | ||
onClick={handleAddItem} | ||
/> | ||
) | ||
} | ||
|
||
export default memo(AddItem) |
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 @@ | ||
import AddItem from './AddItem' | ||
|
||
export default AddItem |
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 @@ | ||
import { memo } from 'react' | ||
import { Input } from '@ui' | ||
import store from '@store' | ||
|
||
const InputItem = () => { | ||
const text = store(({ text }: any) => text) | ||
const setText = store(({ setText }: any) => setText) | ||
|
||
const handleTyped = (text: string) => { | ||
console.log('typed-----', text) | ||
setText(text) | ||
} | ||
|
||
console.log('InputItem', text) | ||
|
||
return ( | ||
<Input | ||
placeholder="New Item ..." | ||
value={text} | ||
onTyped={handleTyped} | ||
/> | ||
) | ||
} | ||
|
||
export default memo(InputItem) |
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 @@ | ||
import InputItem from './InputItem' | ||
|
||
export default InputItem |
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,47 @@ | ||
import { memo } from 'react' | ||
import { XCircleIcon as CloseIcon } from '@heroicons/react/24/outline' | ||
import { Card } from '@ui' | ||
import { tw } from '@utils' | ||
import store from '@store' | ||
|
||
const Item = ({ | ||
name = '' | ||
}) => { | ||
const removeItem = store(({ removeItem }: any) => removeItem) | ||
|
||
const handleRemoveItem = () => { | ||
console.log('remove------', name) | ||
removeItem(name) | ||
} | ||
|
||
console.log('Item', name) | ||
return ( | ||
<Card | ||
className={tw( | ||
'flex', | ||
'justify-between', | ||
'my-4' | ||
)} | ||
> | ||
<p | ||
className={tw( | ||
'w-fit' | ||
)} | ||
> | ||
{name} | ||
</p> | ||
<CloseIcon | ||
onClick={handleRemoveItem} | ||
className={tw( | ||
'w-6', | ||
'h-6', | ||
'text-rose-500', | ||
'hover:text-rose-700', | ||
'cursor-pointer' | ||
)} | ||
/> | ||
</Card> | ||
) | ||
} | ||
|
||
export default memo(Item) |
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 @@ | ||
import Item from './Item' | ||
|
||
export default Item |
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,28 @@ | ||
import { memo } from 'react' | ||
import { Item } from '@components' | ||
import { tw } from '@utils' | ||
import store from '@store' | ||
|
||
const List = () => { | ||
const items = store(({ items }: any) => items) | ||
console.log('List') | ||
return ( | ||
<div> | ||
{items.length | ||
? items.map((item: any) => ( | ||
<Item | ||
key={item.id} | ||
name={item.name} | ||
/>)) | ||
: ( | ||
<div className={tw('text-center')}> | ||
<p className={tw('font-bold')}>There is no Item!</p> | ||
<small>Please open <b className={tw('text-rose-500')}>Dev Tools</b> - <b className={tw('text-rose-500')}>Consol</b> and see the <b className={tw('text-rose-500')}>Rendering</b> log!</small> | ||
</div> | ||
) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
export default memo(List) |
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 @@ | ||
import List from './List' | ||
|
||
export default List |
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,11 @@ | ||
import AddItem from './AddItem' | ||
import InputItem from './InputItem' | ||
import Item from './Item' | ||
import List from './List' | ||
|
||
export { | ||
AddItem, | ||
InputItem, | ||
Item, | ||
List | ||
} |
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,7 +1,7 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
swcMinify: true | ||
} | ||
|
||
module.exports = nextConfig |
Oops, something went wrong.
91934a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextjs-demo – ./
nextjs-demo-umber-two.vercel.app
nextjs-demo-muhammadnurrendra-gmailcom.vercel.app
nextjs-demo-git-main-muhammadnurrendra-gmailcom.vercel.app