-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from shipt/development
Release 1.1.1
- Loading branch information
Showing
19 changed files
with
1,401 additions
and
1,232 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Change Log | ||
|
||
## v1.1.1 | ||
|
||
* Minor dependency updates | ||
|
||
## v1.1.0 | ||
|
||
* Removed deprecated class based container logic | ||
|
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,5 +1,23 @@ | ||
import Osmosis from '@shipt/osmosis'; | ||
import { wrapCounter } from './store'; | ||
import { StoreProvider, configureUsePersistedState } from '@shipt/osmosis'; | ||
import { CounterWrapper, CounterWithReducerWrapper } from './store'; | ||
|
||
import Counter from './counter'; | ||
import PersistedCounter from './persistedCounter.js'; | ||
import DispactCounter from './dispatchCounter.js'; | ||
|
||
configureUsePersistedState({ | ||
getItem: key => JSON.parse(window.localStorage.getItem(key)), | ||
setItem: (key, value) => window.localStorage.setItem(key, JSON.stringify(value)) | ||
}); | ||
|
||
const App = () => { | ||
return ( | ||
<> | ||
<Counter /> | ||
<PersistedCounter /> | ||
<DispactCounter /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Osmosis.StoreProvider([wrapCounter], Counter); | ||
export default StoreProvider([CounterWrapper, CounterWithReducerWrapper], App); |
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,21 @@ | ||
import React, { useContext } from 'react'; | ||
import { CounterWithReducerContext } from './store'; | ||
|
||
const PersistedCounter = () => { | ||
const [counterContext] = useContext(CounterWithReducerContext); | ||
let { dispatch, counterState: { count }} = counterContext; | ||
|
||
return ( | ||
<div data-testid="counter-wrap"> | ||
<p>Dispatch Count: {count}</p> | ||
<button data-testid="decrement" onClick={() => dispatch({type: 'decrement'})}> | ||
- | ||
</button> | ||
<button data-testid="increment" onClick={() => dispatch({type: 'increment'})}> | ||
+ | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PersistedCounter; |
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,21 @@ | ||
import React, { useContext } from 'react'; | ||
import { CounterContext } from './store'; | ||
|
||
const PersistedCounter = () => { | ||
const [counterContext] = useContext(CounterContext); | ||
let { persistedCount } = counterContext.state; | ||
|
||
return ( | ||
<div data-testid="counter-wrap"> | ||
<p>Persisted Count: {persistedCount}</p> | ||
<button data-testid="decrement" onClick={counterContext.decrementPersistedCount}> | ||
- | ||
</button> | ||
<button data-testid="increment" onClick={counterContext.incrementPersistedCount}> | ||
+ | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PersistedCounter; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.