-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b39c58e
commit 6fd90be
Showing
8 changed files
with
105 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Typography } from '@/components/common'; | ||
import { OrderStatus } from '@/lib/types/enums'; | ||
import styles from './style.module.scss'; | ||
|
||
export const orderStatusName: { [_ in OrderStatus]: string } = { | ||
[OrderStatus.FULFILLED]: 'Fulfilled', | ||
[OrderStatus.CANCELLED]: 'Cancelled', | ||
[OrderStatus.PLACED]: 'Placed', | ||
[OrderStatus.PARTIALLY_FULFILLED]: 'Partially Fulfilled', | ||
[OrderStatus.PICKUP_MISSED]: 'Pickup Missed', | ||
[OrderStatus.PICKUP_CANCELLED]: 'Pickup Cancelled', | ||
}; | ||
|
||
export const orderStatusColor: { [_ in OrderStatus]: string } = { | ||
// Green: Order completed and picked up. | ||
[OrderStatus.FULFILLED]: styles.green, | ||
// Gray: Order completed, no further action needed. | ||
[OrderStatus.CANCELLED]: styles.gray, | ||
// Blue: Order pending. | ||
[OrderStatus.PLACED]: styles.blue, | ||
[OrderStatus.PARTIALLY_FULFILLED]: styles.blue, | ||
// Red: Order pending, requires user action. | ||
[OrderStatus.PICKUP_MISSED]: styles.red, | ||
[OrderStatus.PICKUP_CANCELLED]: styles.red, | ||
}; | ||
|
||
interface OrderStatusIndicatorProps { | ||
orderStatus: OrderStatus; | ||
className?: string; | ||
} | ||
|
||
const OrderStatusIndicator = ({ orderStatus, className = '' }: OrderStatusIndicatorProps) => { | ||
return ( | ||
<div className={`${styles.orderStatus} ${orderStatusColor[orderStatus]} ${className}`}> | ||
<Typography variant="body/medium">{orderStatusName[orderStatus]}</Typography> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OrderStatusIndicator; |
36 changes: 36 additions & 0 deletions
36
src/components/store/OrderStatusIndicator/style.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@use 'src/styles/vars.scss' as vars; | ||
|
||
.orderStatus { | ||
background: vars.$gray-2; | ||
border: 1px solid vars.$gray-7; | ||
border-radius: 0.875rem; | ||
color: vars.$gray-7; | ||
margin-right: 1rem; | ||
padding: 0.25rem 0.5rem; | ||
|
||
text-align: center; | ||
|
||
&.green { | ||
background: vars.$green-100; | ||
border: 1px solid vars.$success-1; | ||
color: vars.$success-1; | ||
} | ||
|
||
&.gray { | ||
background: vars.$gray-2; | ||
border: 1px solid vars.$gray-7; | ||
color: vars.$gray-7; | ||
} | ||
|
||
&.blue { | ||
background: vars.$blue-100; | ||
border: 1px solid vars.$dark-primary-5; | ||
color: vars.$dark-primary-5; | ||
} | ||
|
||
&.red { | ||
background: vars.$scarlet-2; | ||
border: 1px solid vars.$danger-1; | ||
color: vars.$danger-1; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/components/store/OrderStatusIndicator/style.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export type Styles = { | ||
blue: string; | ||
gray: string; | ||
green: string; | ||
orderStatus: string; | ||
red: string; | ||
}; | ||
|
||
export type ClassNames = keyof Styles; | ||
|
||
declare const styles: Styles; | ||
|
||
export default styles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters