Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app marketplace): add more and collapse #805

Merged
merged 6 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

- Admin Credential
- Credential Request Management Board Improvements

- App marketplace
- Add more and collapse button to category view

## 2.0.0

### Change
Expand Down
1 change: 1 addition & 0 deletions src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,7 @@
"decline": "Decline",
"confirm": "Bestätigen",
"more": "Mehr",
"collapse": "Einklappen",
"loadmore": "Mehr laden",
"details": "Details",
"close": "Schließen",
Expand Down
1 change: 1 addition & 0 deletions src/assets/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@
"decline": "Decline",
"confirm": "Confirm",
"more": "More",
"collapse": "Collapse",
"loadmore": "Load more",
"details": "Details",
"close": "Close",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,26 @@ export const AppListGroup = ({
items: AppMarketplaceCard[]
}) => {
const { t } = useTranslation()
const [itemsShown, setItemsShown] = useState('4')

const [itemsShown, setItemsShown] = useState(4)
const itemsToShow = items.slice(0, Number(itemsShown))

const increaseItemsShown = () => {
setItemsShown((prevState) => {
return (Number(prevState) + 4).toString()
})
}

return (
<>
<CategoryDivider
buttonText={t('global.actions.more')}
buttonText={
items.length <= 4 || itemsToShow.length < items.length
? t('global.actions.more')
: t('global.actions.collapse')
}
categoryItemsLength={items.length}
categoryName={t(
'content.appstore.appOverviewSection.categories.' +
category.replace(/\s+/g, '').toLowerCase()
)}
disabled={itemsToShow.length >= items.length}
onButtonClick={increaseItemsShown}
disabled={items.length <= 4}
onButtonClick={() => {
setItemsShown(itemsToShow.length >= items.length ? 4 : items.length)
}}
/>
<Cards
buttonText={t('global.actions.details')}
Expand Down
Loading