feat(dashboard): Discounts details + edits (#6547)
**What** - Discounts details page - Edit discount details - Edit discount configurations - `ListSummary` component **NOTE** - conditions edit form will be implemented in a separate PR - edit details from is missing metadata component which will be added later --- https://github.com/medusajs/medusa/assets/16856471/c878af4a-48c2-4c45-b824-662784c7a139
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ export const NoRecords = ({
|
||||
<Text size="small" leading="compact" weight="plus">
|
||||
{title ?? t("general.noRecordsTitle")}
|
||||
</Text>
|
||||
<Text size="small" className="text-ui-fg-subtle">
|
||||
<Text size="small" className="text-ui-fg-muted">
|
||||
{message ?? t("general.noRecordsMessage")}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { ListSummary } from "./list-summary"
|
||||
@@ -0,0 +1,58 @@
|
||||
import { Text, Tooltip, clx } from "@medusajs/ui"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
type ListSummaryProps = {
|
||||
/**
|
||||
* Number of initial items to display
|
||||
* @default 2
|
||||
*/
|
||||
n?: number
|
||||
/**
|
||||
* List of strings to display as abbreviated list
|
||||
*/
|
||||
list: string[]
|
||||
/**
|
||||
* Is hte summary displayed inline.
|
||||
* Determines whether the center text is truncated if there is no space in the container
|
||||
*/
|
||||
inline?: boolean
|
||||
}
|
||||
|
||||
export const ListSummary = ({ list, inline, n = 2 }: ListSummaryProps) => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<div
|
||||
className={clx("text-ui-fg-subtle gap-x-2", {
|
||||
"inline-flex": inline,
|
||||
flex: !inline,
|
||||
})}
|
||||
>
|
||||
<Text as="span" leading="compact" size="small" className="truncate">
|
||||
{list.slice(0, n).join(", ")}
|
||||
</Text>
|
||||
{list.length > n && (
|
||||
<Tooltip
|
||||
content={
|
||||
<ul>
|
||||
{list.slice(n).map((c) => (
|
||||
<li key={c}>{c}</li>
|
||||
))}
|
||||
</ul>
|
||||
}
|
||||
>
|
||||
<Text
|
||||
as="span"
|
||||
size="small"
|
||||
weight="plus"
|
||||
leading="compact"
|
||||
className="cursor-default whitespace-nowrap"
|
||||
>
|
||||
{t("general.plusCountMore", {
|
||||
count: list.length - n,
|
||||
})}
|
||||
</Text>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user