Skip to content

Commit

Permalink
fix(collection-view): heading aligment to the center (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasaarcoverde authored Aug 22, 2024
2 parents 5b80d45 + 4639a35 commit 451c86c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ComponentPropsWithoutRef } from 'react'
import { forwardRef } from 'react'
import {
IconMagnifyingGlass,
IconPlus,
IconPlusCircle,
IconProhibit,
IconWarningCircle,
} from '../../icons'
import type { ComponentPropsWithoutRef } from 'react'
import { forwardRef } from 'react'
import { Button } from '../button'
import {
EmptyState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './stories.css'
import { CollectionView, Collection, CollectionRow } from '../index'
import { Search } from '../../search'
import { Pagination } from '../../pagination'
import { Filter, FilterItem } from '../../filter'
import { Pagination } from '../../pagination'
import { Search } from '../../search'
import { Stack } from '../../stack'
import { Collection, CollectionRow, CollectionView } from '../index'
import './stories.css'

export default {
title: 'components/collection',
Expand Down Expand Up @@ -199,7 +199,89 @@ export function Show() {
<Pagination page={1} total={74} />
</CollectionRow>
</Collection>
{/* Custom label */}
{/* Empty custom messages */}
<Collection>
<CollectionRow>
<Stack horizontal space="$space-3">
<Search />
<Filter label="Status">
<FilterItem value="Stable">Stable</FilterItem>
<FilterItem value="Experimental">Experimental</FilterItem>
<FilterItem value="Deprecated">Deprecated</FilterItem>
</Filter>
</Stack>
<Pagination page={1} total={74} />
</CollectionRow>
<CollectionView
status="empty"
messages={{
'empty-heading': 'No products created inside this category yet.',
'empty-description': 'Use the button below to create a new product',
'empty-action': 'Create product',
}}
onEmpty={() => alert('On empty action')}
>
<div className="ready-view" />
</CollectionView>
<CollectionRow align="flex-end">
<Pagination page={1} total={74} />
</CollectionRow>
</Collection>
{/* Error custom messages */}
<Collection>
<CollectionRow>
<Stack horizontal space="$space-3">
<Search />
<Filter label="Status">
<FilterItem value="Stable">Stable</FilterItem>
<FilterItem value="Experimental">Experimental</FilterItem>
<FilterItem value="Deprecated">Deprecated</FilterItem>
</Filter>
</Stack>
<Pagination page={1} total={74} />
</CollectionRow>
<CollectionView
status="error"
messages={{
'error-heading': 'Error fetching products',
'error-action': 'Retry',
}}
onError={() => alert('On error action')}
>
<div className="ready-view" />
</CollectionView>
<CollectionRow align="flex-end">
<Pagination page={1} total={74} />
</CollectionRow>
</Collection>
{/* Unauthorized custom messages */}
<Collection>
<CollectionRow>
<Stack horizontal space="$space-3">
<Search />
<Filter label="Status">
<FilterItem value="Stable">Stable</FilterItem>
<FilterItem value="Experimental">Experimental</FilterItem>
<FilterItem value="Deprecated">Deprecated</FilterItem>
</Filter>
</Stack>
<Pagination page={1} total={74} />
</CollectionRow>
<CollectionView
status="unauthorized"
messages={{
'unauthorized-heading': 'Unauthorized Access',
'unauthorized-description':
'You do not have permission to view this content',
}}
>
<div className="ready-view" />
</CollectionView>
<CollectionRow align="flex-end">
<Pagination page={1} total={74} />
</CollectionRow>
</Collection>
{/* Not found custom messages */}
<Collection>
<CollectionRow>
<Stack horizontal space="$space-3">
Expand All @@ -213,8 +295,11 @@ export function Show() {
<Pagination page={1} total={74} />
</CollectionRow>
<CollectionView
status="ready"
messages={{ 'empty-action': 'Create product' }}
status="not-found"
messages={{
'not-found-heading': 'No products found',
'not-found-description': 'No products match your search criteria',
}}
>
<div className="ready-view" />
</CollectionView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@

[data-sl-collection-view] {
min-height: 23.75rem;

&:not([data-sl-collection-view-ready]) {
display: flex;
justify-items: center;
align-items: center;
align-items: center;
}
}

[data-sl-collection-view-heading] {
text-align: center;
}

0 comments on commit 451c86c

Please sign in to comment.