fix(admin-ui): table action gap (#3386)

* add gap in table actions

* add changeset

* Update .changeset/light-frogs-smoke.md

Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>

---------

Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2023-03-07 13:14:14 +01:00
1 parent b4eba69911
commit 06f567f446
3 files changed
+25 -21

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix(admin-ui): Add gap in table actions
@@ -1,13 +1,11 @@
import clsx from "clsx"
import React from "react"
import { useNavigate } from "react-router-dom"
import Spinner from "../../atoms/spinner"
import ArrowLeftIcon from "../../fundamentals/icons/arrow-left-icon"
import ArrowRightIcon from "../../fundamentals/icons/arrow-right-icon"
import SortingIcon from "../../fundamentals/icons/sorting-icon"
import Actionables, { ActionType } from "../../molecules/actionables" import Actionables, { ActionType } from "../../molecules/actionables"
import FilteringOptions, { FilteringOptionProps } from "./filtering-option" import FilteringOptions, { FilteringOptionProps } from "./filtering-option"
import React from "react"
import SortingIcon from "../../fundamentals/icons/sorting-icon"
import TableSearch from "./table-search" import TableSearch from "./table-search"
import clsx from "clsx"
import { useNavigate } from "react-router-dom"
type TableRowProps = React.HTMLAttributes<HTMLTableRowElement> & { type TableRowProps = React.HTMLAttributes<HTMLTableRowElement> & {
forceDropdown?: boolean forceDropdown?: boolean
@@ -73,9 +71,9 @@ const Table = React.forwardRef<HTMLTableElement, TableProps>(
return ( return (
<div className={`flex flex-col ${containerClassName}`}> <div className={`flex flex-col ${containerClassName}`}>
<div className="w-full flex justify-between mb-2"> <div className="mb-2 flex w-full justify-between">
{filteringOptions ? ( {filteringOptions ? (
<div className="flex mb-2 self-end"> <div className="mb-2 flex self-end">
{Array.isArray(filteringOptions) {Array.isArray(filteringOptions)
? filteringOptions.map((fo) => <FilteringOptions {...fo} />) ? filteringOptions.map((fo) => <FilteringOptions {...fo} />)
: filteringOptions} : filteringOptions}
@@ -83,7 +81,7 @@ const Table = React.forwardRef<HTMLTableElement, TableProps>(
) : ( ) : (
<span aria-hidden /> <span aria-hidden />
)} )}
<div className="flex items-center"> <div className="gap-x-xsmall flex items-center">
{tableActions && <div>{tableActions}</div>} {tableActions && <div>{tableActions}</div>}
{enableSearch && ( {enableSearch && (
<TableSearch <TableSearch
@@ -116,7 +114,7 @@ Table.Head = React.forwardRef<
<thead <thead
ref={ref} ref={ref}
className={clsx( className={clsx(
"whitespace-nowrap inter-small-semibold text-grey-50 border-t border-b border-grey-20", "inter-small-semibold text-grey-50 border-grey-20 whitespace-nowrap border-t border-b",
className className
)} )}
{...props} {...props}
@@ -138,7 +136,7 @@ Table.HeadCell = React.forwardRef<
HTMLTableCellElement, HTMLTableCellElement,
React.HTMLAttributes<HTMLTableCellElement> React.HTMLAttributes<HTMLTableCellElement>
>(({ className, children, ...props }, ref) => ( >(({ className, children, ...props }, ref) => (
<th ref={ref} className={clsx("text-left h-[40px]", className)} {...props}> <th ref={ref} className={clsx("h-[40px] text-left", className)} {...props}>
{children} {children}
</th> </th>
)) ))
@@ -159,9 +157,9 @@ Table.SortingHeadCell = React.forwardRef<
ref ref
) => { ) => {
return ( return (
<th ref={ref} className={clsx("text-left py-2.5", className)} {...props}> <th ref={ref} className={clsx("py-2.5 text-left", className)} {...props}>
<div <div
className="flex items-center cursor-pointer select-none" className="flex cursor-pointer select-none items-center"
onClick={(e) => { onClick={(e) => {
e.preventDefault() e.preventDefault()
if (!sortDirection) { if (!sortDirection) {
@@ -225,9 +223,9 @@ Table.Row = React.forwardRef<HTMLTableRowElement, TableRowProps>(
<tr <tr
ref={ref} ref={ref}
className={clsx( className={clsx(
"inter-small-regular border-t border-b border-grey-20 text-grey-90", "inter-small-regular border-grey-20 text-grey-90 border-t border-b",
className, className,
{ "cursor-pointer hover:bg-grey-5": linkTo !== undefined } { "hover:bg-grey-5 cursor-pointer": linkTo !== undefined }
)} )}
{...props} {...props}
{...(linkTo && { {...(linkTo && {
@@ -1,14 +1,15 @@
import React, { useState } from "react" import React, { useState } from "react"
import { usePagination, useRowSelect, useTable } from "react-table"
import Modal from "../../../../components/molecules/modal"
import { useDebounce } from "../../../../hooks/use-debounce"
import SalesChannelTable, { import SalesChannelTable, {
SalesChannelTableActions, SalesChannelTableActions,
useSalesChannelsTableColumns, useSalesChannelsTableColumns,
} from "./table" } from "./table"
import { usePagination, useRowSelect, useTable } from "react-table"
import Modal from "../../../../components/molecules/modal"
import { useDebounce } from "../../../../hooks/use-debounce"
import { useSalesChannelsModal } from "./use-sales-channels-modal" import { useSalesChannelsModal } from "./use-sales-channels-modal"
const LIMIT = 15 const LIMIT = 12
const AvailableScreen = () => { const AvailableScreen = () => {
const { source, onSave } = useSalesChannelsModal() const { source, onSave } = useSalesChannelsModal()
@@ -75,7 +76,7 @@ const AvailableScreen = () => {
/> />
} }
setSelectedRowIds={setSelectedRowIds} setSelectedRowIds={setSelectedRowIds}
limit={15} limit={LIMIT}
offset={offset} offset={offset}
setOffset={setOffset} setOffset={setOffset}
setQuery={setQuery} setQuery={setQuery}