Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
feat: status badge for product (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiannicolajsen authored and fPolic committed Mar 1, 2022
1 parent b484e3b commit 3f3afb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/domain/products/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import Button from "../../components/button"
import qs from "query-string"
import styled from "@emotion/styled"

import Badge from "../../components/badge"
import { decideBadgeColor } from "../../utils/decide-badge-color"

const LinkWrapper = styled(Link)`
width: 100%;
height: 100%;
Expand Down Expand Up @@ -279,6 +282,7 @@ const ProductIndex = () => {
<TableHeaderCell sx={{ maxWidth: "75px" }} />
<TableHeaderCell>Name</TableHeaderCell>
<TableHeaderCell>Collection</TableHeaderCell>
<TableHeaderCell>Status</TableHeaderCell>
<TableHeaderCell>Inventory</TableHeaderCell>
<TableHeaderCell />
</TableHeaderRow>
Expand Down Expand Up @@ -352,6 +356,16 @@ const ProductIndex = () => {
{p.collection?.title || "-"}
</DefaultCellContent>
</TableDataCell>
<TableDataCell>
<DefaultCellContent>
<Badge
color={decideBadgeColor(p.status).color}
bg={decideBadgeColor(p.status).bgColor}
>
{p.status}
</Badge>
</DefaultCellContent>
</TableDataCell>
<TableDataCell>
<DefaultCellContent>
{p.variants.reduce(
Expand Down
1 change: 1 addition & 0 deletions src/utils/decide-badge-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export function decideBadgeColor(batchLabel) {
case "captured":
case "completed":
case "shipped":
case "published":
case "registered":
case "difference_refunded":
case "received":
Expand Down

0 comments on commit 3f3afb7

Please sign in to comment.