Fix stories
This commit is contained in:
parent
9e00800956
commit
e520f30a86
3 changed files with 36 additions and 79 deletions
|
@ -1,5 +1,4 @@
|
||||||
import { ShopInfo_shop_permissions } from "./components/Shop/types/ShopInfo";
|
import { ShopInfo_shop_permissions } from "./components/Shop/types/ShopInfo";
|
||||||
import { Filter } from "./components/TableFilter";
|
|
||||||
import {
|
import {
|
||||||
FetchMoreProps,
|
FetchMoreProps,
|
||||||
FilterPageProps,
|
FilterPageProps,
|
||||||
|
@ -303,80 +302,14 @@ export const searchPageProps: SearchPageProps = {
|
||||||
onSearchChange: () => undefined
|
onSearchChange: () => undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
export const filterPageProps: FilterPageProps = {
|
export const filterPageProps: FilterPageProps<string, object> = {
|
||||||
...searchPageProps,
|
...searchPageProps,
|
||||||
...tabPageProps,
|
...tabPageProps,
|
||||||
currencySymbol: "USD",
|
currencySymbol: "USD",
|
||||||
filtersList: [],
|
filterOpts: {},
|
||||||
onFilterAdd: () => undefined
|
onFilterChange: () => undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
export const filters: Filter[] = [
|
|
||||||
{
|
|
||||||
label: "Property X is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Y is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Z is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property X is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Y is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Z is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property X is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Y is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Z is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property X is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Y is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Z is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property X is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Y is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Property Z is ",
|
|
||||||
onClick: () => undefined
|
|
||||||
}
|
|
||||||
].map((filter, filterIndex) => ({
|
|
||||||
...filter,
|
|
||||||
label: filter.label + filterIndex
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const fetchMoreProps: FetchMoreProps = {
|
export const fetchMoreProps: FetchMoreProps = {
|
||||||
hasMore: true,
|
hasMore: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
|
@ -5,9 +5,9 @@ import OrderListPage, {
|
||||||
OrderListPageProps
|
OrderListPageProps
|
||||||
} from "@saleor/orders/components/OrderListPage";
|
} from "@saleor/orders/components/OrderListPage";
|
||||||
import { OrderListUrlSortField } from "@saleor/orders/urls";
|
import { OrderListUrlSortField } from "@saleor/orders/urls";
|
||||||
|
import { OrderStatusFilter } from "@saleor/types/globalTypes";
|
||||||
import {
|
import {
|
||||||
filterPageProps,
|
filterPageProps,
|
||||||
filters,
|
|
||||||
listActionsProps,
|
listActionsProps,
|
||||||
pageListProps,
|
pageListProps,
|
||||||
sortPageProps
|
sortPageProps
|
||||||
|
@ -20,6 +20,19 @@ const props: OrderListPageProps = {
|
||||||
...pageListProps.default,
|
...pageListProps.default,
|
||||||
...filterPageProps,
|
...filterPageProps,
|
||||||
...sortPageProps,
|
...sortPageProps,
|
||||||
|
filterOpts: {
|
||||||
|
created: {
|
||||||
|
active: false,
|
||||||
|
value: {
|
||||||
|
max: "400",
|
||||||
|
min: "50"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
active: false,
|
||||||
|
value: [OrderStatusFilter.CANCELED, OrderStatusFilter.FULFILLED]
|
||||||
|
}
|
||||||
|
},
|
||||||
orders,
|
orders,
|
||||||
sort: {
|
sort: {
|
||||||
...sortPageProps.sort,
|
...sortPageProps.sort,
|
||||||
|
@ -30,9 +43,6 @@ const props: OrderListPageProps = {
|
||||||
storiesOf("Views / Orders / Order list", module)
|
storiesOf("Views / Orders / Order list", module)
|
||||||
.addDecorator(Decorator)
|
.addDecorator(Decorator)
|
||||||
.add("default", () => <OrderListPage {...props} />)
|
.add("default", () => <OrderListPage {...props} />)
|
||||||
.add("with custom filters", () => (
|
|
||||||
<OrderListPage {...props} filtersList={filters} />
|
|
||||||
))
|
|
||||||
.add("loading", () => (
|
.add("loading", () => (
|
||||||
<OrderListPage
|
<OrderListPage
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -7,10 +7,11 @@ import { products as productListFixture } from "@saleor/products/fixtures";
|
||||||
import { ProductListUrlSortField } from "@saleor/products/urls";
|
import { ProductListUrlSortField } from "@saleor/products/urls";
|
||||||
import { attributes } from "@saleor/productTypes/fixtures";
|
import { attributes } from "@saleor/productTypes/fixtures";
|
||||||
import { ListViews } from "@saleor/types";
|
import { ListViews } from "@saleor/types";
|
||||||
|
import { ProductStatus } from "@saleor/products/types";
|
||||||
|
import { StockAvailability } from "@saleor/types/globalTypes";
|
||||||
import {
|
import {
|
||||||
fetchMoreProps,
|
fetchMoreProps,
|
||||||
filterPageProps,
|
filterPageProps,
|
||||||
filters,
|
|
||||||
listActionsProps,
|
listActionsProps,
|
||||||
pageListProps,
|
pageListProps,
|
||||||
sortPageProps
|
sortPageProps
|
||||||
|
@ -37,6 +38,23 @@ const props: ProductListPageProps = {
|
||||||
activeAttributeSortId: undefined,
|
activeAttributeSortId: undefined,
|
||||||
availableInGridAttributes: attributes,
|
availableInGridAttributes: attributes,
|
||||||
defaultSettings: defaultListSettings[ListViews.PRODUCT_LIST],
|
defaultSettings: defaultListSettings[ListViews.PRODUCT_LIST],
|
||||||
|
filterOpts: {
|
||||||
|
price: {
|
||||||
|
active: false,
|
||||||
|
value: {
|
||||||
|
max: "30",
|
||||||
|
min: "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
active: false,
|
||||||
|
value: ProductStatus.PUBLISHED
|
||||||
|
},
|
||||||
|
stockStatus: {
|
||||||
|
active: false,
|
||||||
|
value: StockAvailability.IN_STOCK
|
||||||
|
}
|
||||||
|
},
|
||||||
gridAttributes: attributes,
|
gridAttributes: attributes,
|
||||||
products,
|
products,
|
||||||
settings: {
|
settings: {
|
||||||
|
@ -49,14 +67,10 @@ const props: ProductListPageProps = {
|
||||||
storiesOf("Views / Products / Product list", module)
|
storiesOf("Views / Products / Product list", module)
|
||||||
.addDecorator(Decorator)
|
.addDecorator(Decorator)
|
||||||
.add("default", () => <ProductListPage {...props} />)
|
.add("default", () => <ProductListPage {...props} />)
|
||||||
.add("with custom filters", () => (
|
|
||||||
<ProductListPage {...props} filtersList={filters} />
|
|
||||||
))
|
|
||||||
.add("loading", () => (
|
.add("loading", () => (
|
||||||
<ProductListPage
|
<ProductListPage
|
||||||
{...props}
|
{...props}
|
||||||
products={undefined}
|
products={undefined}
|
||||||
filtersList={undefined}
|
|
||||||
currentTab={undefined}
|
currentTab={undefined}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue