-
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.
Now load more button adds more pokemon • working on pricing structure…
… • Starting work on theming
- Loading branch information
1 parent
193177a
commit 71d3800
Showing
35 changed files
with
388 additions
and
159 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
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
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,8 +1,3 @@ | ||
.contentWrapper { | ||
display: flex; | ||
align-content: space-between; | ||
gap: 25px; | ||
flex-wrap: wrap; | ||
margin-top: 25px; | ||
justify-content: center; | ||
} |
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 +1,12 @@ | ||
/* You can add global styles to this file, and also import other style files */ | ||
:root, | ||
html[data-theme='light'] { | ||
--background-color: #fff; | ||
--text-color: #121416d8; | ||
--link-color: #543fd7; | ||
} | ||
|
||
html[data-theme='dark'] { | ||
--background-color: #212a2e; | ||
--text-color: #f7f8f8; | ||
--link-color: #828fff; | ||
} |
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
7 changes: 7 additions & 0 deletions
7
libs/features/src/lib/pokemon/pokemon.list/pokemon.list.module.css
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,7 @@ | ||
.cardListWrapper { | ||
display: flex; | ||
align-content: space-between; | ||
gap: 25px; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
} |
11 changes: 11 additions & 0 deletions
11
libs/features/src/lib/pokemon/pokemon.list/pokemon.list.module.native.ts
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 { StyleSheet } from 'react-native'; | ||
|
||
export const styles = StyleSheet.create({ | ||
cardListWrapper: { | ||
display: 'flex', | ||
alignContent: 'space-between', | ||
gap: 25, | ||
flexWrap: 'wrap', | ||
justifyContent: 'center', | ||
}, | ||
}); |
3 changes: 3 additions & 0 deletions
3
libs/features/src/lib/pokemon/pokemon.list/pokemon.list.module.ts
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 styles from './pokemon.list.module.css'; | ||
|
||
export { styles }; |
38 changes: 33 additions & 5 deletions
38
libs/features/src/lib/pokemon/pokemon.list/pokemon.list.view.tsx
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,18 +1,46 @@ | ||
import { memo, ReactElement } from 'react'; | ||
import { Fragment, memo, ReactElement } from 'react'; | ||
|
||
import { PokemonListApi } from '@pokemon-pet-shop/typing'; | ||
import { UiButton, UiElementLayout } from '@pokemon-pet-shop/ui'; | ||
|
||
import { UiPokemonCard } from '../pokemon.card'; | ||
|
||
import { styles } from './pokemon.list.module'; | ||
import usePokemonList from './use.pokemon.list.logic'; | ||
|
||
/** Use tanstack virtual for long lists -> https://tanstack.com/virtual/latest/docs/introduction */ | ||
const PokemonList = (): ReactElement => { | ||
const { data, isError, isLoading, isFetching } = usePokemonList(); | ||
const { data, isError, isLoading, isFetching, isFetchingNextPage, hasNextPage, onFetchNextPage } = | ||
usePokemonList(); | ||
|
||
return (data || []).map((el: PokemonListApi): ReactElement => { | ||
return <UiPokemonCard key={el?.name} data={el} />; | ||
}); | ||
return ( | ||
<> | ||
<UiElementLayout className={styles.cardListWrapper}> | ||
{(data || []).map((arr: PokemonListApi[], i: number): ReactElement => { | ||
return ( | ||
<Fragment key={i}> | ||
{arr.map((el: PokemonListApi) => ( | ||
<UiPokemonCard key={el?.name} data={el} /> | ||
))} | ||
</Fragment> | ||
); | ||
})} | ||
</UiElementLayout> | ||
<UiButton | ||
isDisabled={!hasNextPage || isFetchingNextPage} | ||
text={ | ||
isFetchingNextPage | ||
? 'Loading more...' | ||
: hasNextPage | ||
? 'Load More' | ||
: 'Nothing more to load' | ||
} | ||
onClick={() => { | ||
onFetchNextPage((old: number) => old + 1); | ||
}} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default memo(PokemonList); |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './lib/theme.store'; | ||
export * from './lib/modal.store'; | ||
export * from './lib/cart.store'; | ||
export * from './lib/loading.submit.store'; |
Oops, something went wrong.