feat(dashboard,ui): Streamline spacing and sizing (#6061)

This commit is contained in:
Kasper Fabricius Kristensen
2024-01-15 11:43:16 +01:00
committed by GitHub
parent 5dacd4ac9f
commit a2c149e7e5
266 changed files with 10738 additions and 4646 deletions

View File

@@ -0,0 +1 @@
export * from "./localized-date-picker"

View File

@@ -0,0 +1,36 @@
import { DatePicker } from "@medusajs/ui"
import { ComponentPropsWithoutRef } from "react"
import { useTranslation } from "react-i18next"
import { languages } from "../../../i18n/config"
type LocalizedDatePickerProps = Omit<
ComponentPropsWithoutRef<typeof DatePicker>,
"translations" | "locale"
>
export const LocalizedDatePicker = ({
mode = "single",
...props
}: LocalizedDatePickerProps) => {
const { i18n, t } = useTranslation()
const locale = languages.find((lang) => lang.code === i18n.language)
?.date_locale
const translations = {
cancel: t("general.cancel"),
apply: t("general.apply"),
end: t("general.end"),
start: t("general.start"),
range: t("general.range"),
}
return (
<DatePicker
mode={mode}
translations={translations}
locale={locale}
{...(props as any)}
/>
)
}

View File

@@ -0,0 +1 @@
export * from "./localized-table-pagination"

View File

@@ -0,0 +1,26 @@
import { Table } from "@medusajs/ui"
import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react"
import { useTranslation } from "react-i18next"
type LocalizedTablePaginationProps = Omit<
ComponentPropsWithoutRef<typeof Table.Pagination>,
"translations"
>
export const LocalizedTablePagination = forwardRef<
ElementRef<typeof Table.Pagination>,
LocalizedTablePaginationProps
>((props, ref) => {
const { t } = useTranslation()
const translations = {
of: t("general.of"),
results: t("general.results"),
pages: t("general.pages"),
prev: t("general.prev"),
next: t("general.next"),
}
return <Table.Pagination {...props} translations={translations} ref={ref} />
})
LocalizedTablePagination.displayName = "LocalizedTablePagination"