Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions site/src/hooks/useClickableTableRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* It might not make sense to test this hook until the underlying design
* problems are fixed.
*/
import { type CSSObject, useTheme } from "@emotion/react";
import type { TableRowProps } from "@mui/material/TableRow";
import type { MouseEventHandler } from "react";
import { cn } from "utils/cn";
import {
type ClickableAriaRole,
type UseClickableResult,
Expand All @@ -26,7 +26,7 @@ type UseClickableTableRowResult<
TRole extends ClickableAriaRole = ClickableAriaRole,
> = UseClickableResult<HTMLTableRowElement, TRole> &
TableRowProps & {
css: CSSObject;
className: string;
hover: true;
onAuxClick: MouseEventHandler<HTMLTableRowElement>;
};
Expand Down Expand Up @@ -54,23 +54,13 @@ export const useClickableTableRow = <
onAuxClick: externalOnAuxClick,
}: UseClickableTableRowConfig<TRole>): UseClickableTableRowResult<TRole> => {
const clickableProps = useClickable(onClick, (role ?? "button") as TRole);
const theme = useTheme();

return {
...clickableProps,
css: {
cursor: "pointer",

"&:focus": {
outline: `1px solid ${theme.palette.primary.main}`,
outlineOffset: -1,
},

"&:last-of-type": {
borderBottomLeftRadius: 8,
borderBottomRightRadius: 8,
},
},
className: cn([
"cursor-pointer hover:outline focus:outline outline-1 -outline-offset-1 outline-border-hover",
"first:rounded-t-md last:rounded-b-md",
]),
hover: true,
onDoubleClick,
onAuxClick: (event) => {
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/TemplatesPage/TemplatesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const TemplateRow: FC<TemplateRowProps> = ({
);
const navigate = useNavigate();

const { css: clickableCss, ...clickableRow } = useClickableTableRow({
const clickableRow = useClickableTableRow({
onClick: () => navigate(templatePageLink),
});

Expand All @@ -111,7 +111,7 @@ const TemplateRow: FC<TemplateRowProps> = ({
key={template.id}
data-testid={`template-${template.id}`}
{...clickableRow}
css={[clickableCss, styles.tableRow]}
css={styles.tableRow}
>
<TableCell>
<AvatarData
Expand Down
5 changes: 1 addition & 4 deletions site/src/pages/WorkspacesPage/LastUsed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useTheme } from "@emotion/react";
import { Stack } from "components/Stack/Stack";
import { StatusIndicatorDot } from "components/StatusIndicator/StatusIndicator";
import dayjs from "dayjs";
Expand All @@ -12,8 +11,6 @@ interface LastUsedProps {
}

export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
const theme = useTheme();

const [circle, message] = useTime(() => {
const t = dayjs(lastUsedAt);
const now = dayjs();
Expand All @@ -40,7 +37,7 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {

return (
<Stack
style={{ color: theme.palette.text.secondary }}
className="text-content-secondary"
direction="row"
spacing={1}
alignItems="center"
Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy