summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/ProductBadgeShelf.svelte
diff options
context:
space:
mode:
authorrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
committerrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
commitbce557cc2dc767628bed6aac87301a1be7c5431b (patch)
treeb51a051228d01fe3306cd7626d4a96768aadb944 /src/components/jet/shelf/ProductBadgeShelf.svelte
init commit
Diffstat (limited to 'src/components/jet/shelf/ProductBadgeShelf.svelte')
-rw-r--r--src/components/jet/shelf/ProductBadgeShelf.svelte59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/components/jet/shelf/ProductBadgeShelf.svelte b/src/components/jet/shelf/ProductBadgeShelf.svelte
new file mode 100644
index 0000000..cded0b7
--- /dev/null
+++ b/src/components/jet/shelf/ProductBadgeShelf.svelte
@@ -0,0 +1,59 @@
+<script lang="ts" context="module">
+ import type { Badge, Shelf } from '@jet-app/app-store/api/models';
+
+ interface ProductBadgeShelf extends Shelf {
+ items: Badge[];
+ }
+
+ export function isProductBadgeShelf(
+ shelf: Shelf,
+ ): shelf is ProductBadgeShelf {
+ const { contentType, items } = shelf || {};
+ return contentType === 'productBadge' && Array.isArray(items);
+ }
+</script>
+
+<script lang="ts">
+ import ShelfItemLayout from '~/components/ShelfItemLayout.svelte';
+ import ProductBadgeItem from '~/components/jet/item/ProductBadgeItem.svelte';
+ import ShelfWrapper from '~/components/Shelf/Wrapper.svelte';
+
+ export let shelf: ProductBadgeShelf;
+
+ $: shelf.items = shelf.items.filter(
+ (item) => item.type !== 'friendsPlaying',
+ );
+</script>
+
+<ShelfWrapper {shelf} withBottomPadding={false} withTopMargin={true}>
+ <div class="inforibbon-shelf-wrapper">
+ <ShelfItemLayout {shelf} gridType="ProductBadge" let:item>
+ <ProductBadgeItem {item} />
+ </ShelfItemLayout>
+ </div>
+</ShelfWrapper>
+
+<style lang="scss">
+ .inforibbon-shelf-wrapper {
+ padding-bottom: 16px;
+ }
+
+ .inforibbon-shelf-wrapper :global(ul) {
+ display: grid;
+
+ /*
+ Here we are overriding the grid template styles from `ShelfItemLayout -> Grid`,
+ to make it so the badge row always takes up the full-width of the browser until
+ when not in the XS/mobile view.
+ */
+ @media (--range-small-up) {
+ display: flex;
+ justify-content: space-between;
+ }
+ }
+
+ // prevent collapse of focus outlines
+ .inforibbon-shelf-wrapper :global(a) {
+ display: block;
+ }
+</style>