Skip to content

chore: convert emotion styles to tailwind #19347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: lilac/use-class-name-pt-1
Choose a base branch
from
Open
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
38 changes: 10 additions & 28 deletions site/src/components/EmptyState/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { FC, HTMLAttributes, ReactNode } from "react";
import { cn } from "utils/cn";

export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
/** Text Message to display, placed inside Typography component */
Expand All @@ -21,44 +22,25 @@ export const EmptyState: FC<EmptyStateProps> = ({
cta,
image,
isCompact,
className,
...attrs
}) => {
return (
<div
css={[
{
overflow: "hidden",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
textAlign: "center",
minHeight: 360,
padding: "80px 40px",
position: "relative",
},
isCompact && {
minHeight: 180,
padding: "10px 40px",
},
]}
className={cn(
"overflow-hidden flex flex-col justify-center items-center text-center min-h-90 py-20 px-10 relative",
isCompact && "min-h-45 py-2.5",
className,
)}
{...attrs}
>
<h5 css={{ fontSize: 24, fontWeight: 500, margin: 0 }}>{message}</h5>
<h5 className="text-2xl font-medium m-0">{message}</h5>
{description && (
<p
css={(theme) => ({
marginTop: 16,
fontSize: 16,
lineHeight: "140%",
maxWidth: 480,
color: theme.palette.text.secondary,
})}
>
<p className="mt-4 line-height-[140%] max-w-md text-content-secondary">
{description}
</p>
)}
{cta && <div css={{ marginTop: 24 }}>{cta}</div>}
{cta && <div className="mt-6">{cta}</div>}
{image}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/FullPageForm/FullPageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const FullPageForm: FC<FullPageFormProps> = ({
}) => {
return (
<Margins size="small">
<PageHeader css={{ paddingBottom: 24 }}>
<PageHeader className="pb-6">
<PageHeaderTitle>{title}</PageHeaderTitle>
{detail && <PageHeaderSubtitle>{detail}</PageHeaderSubtitle>}
</PageHeader>
Expand Down
12 changes: 1 addition & 11 deletions site/src/components/FullPageLayout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@ export const Sidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
const theme = useTheme();
return (
<div
css={{
width: 260,
borderRight: `1px solid ${theme.palette.divider}`,
height: "100%",
overflow: "auto",
flexShrink: 0,
padding: "8px 0",
display: "flex",
flexDirection: "column",
gap: 1,
}}
className="w-64 border-0 border-solid border-r border-r-border h-full overflow-auto shrink-0 py-2 flex flex-col gap-px"
{...props}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/LastSeen/LastSeen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const LastSeen: FC<LastSeenProps> = ({ at, className, ...attrs }) => {
return (
<span
data-chromatic="ignore"
css={{ color }}
style={{ color }}
{...attrs}
className={cn(["whitespace-nowrap", className])}
>
Expand Down
16 changes: 3 additions & 13 deletions site/src/components/Latency/Latency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ export const Latency: FC<LatencyProps> = ({
if (isLoading) {
return (
<Tooltip title="Loading latency...">
<CircularProgress
size={size}
css={{ marginLeft: "auto" }}
style={{ color }}
/>
<CircularProgress size={size} className="ml-auto" style={{ color }} />
</Tooltip>
);
}
Expand All @@ -41,20 +37,14 @@ export const Latency: FC<LatencyProps> = ({
<>
<span css={{ ...visuallyHidden }}>{notAvailableText}</span>

<CircleHelpIcon
className="size-icon-sm"
css={{
marginLeft: "auto",
}}
style={{ color }}
/>
<CircleHelpIcon className="ml-auto size-icon-sm" style={{ color }} />
</>
</Tooltip>
);
}

return (
<p css={{ fontSize: 13, margin: "0 0 0 auto" }} style={{ color }}>
<p className="ml-auto text-sm" style={{ color }}>
<span css={{ ...visuallyHidden }}>Latency: </span>
{latency.toFixed(0)}
<Abbr title="milliseconds">ms</Abbr>
Expand Down
11 changes: 1 addition & 10 deletions site/src/components/PaginationWidget/PaginationWidgetBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ export const PaginationWidgetBase: FC<PaginationWidgetBaseProps> = ({
);

return (
<div
css={{
justifyContent: "center",
alignItems: "center",
display: "flex",
flexDirection: "row",
padding: "0 20px",
columnGap: "6px",
}}
>
<div className="flex flex-row items-center justify-center px-5 gap-x-1.5">
<PaginationNavButton
disabledMessage="You are already on the first page"
disabled={isPrevDisabled}
Expand Down
44 changes: 7 additions & 37 deletions site/src/components/Paywall/Paywall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ export const Paywall: FC<PaywallProps> = ({
return (
<div css={styles.root}>
<div>
<Stack direction="row" alignItems="center" css={{ marginBottom: 24 }}>
<h5 css={styles.title}>{message}</h5>
<Stack direction="row" alignItems="center" className="mb-6">
<h5 className="font-semibold font-inherit text-xl m-0">{message}</h5>
<PremiumBadge />
</Stack>

{description && <p css={styles.description}>{description}</p>}
{description && <p className="font-inherit max-w-md text-sm">{description}</p>}
<Link
href={documentationLink}
target="_blank"
rel="noreferrer"
css={{ fontWeight: 600 }}
className="font-semibold"
>
Read the documentation
</Link>
</div>
<div css={styles.separator} />
<div className="w-px h-55 bg-border ml-2" />
<Stack direction="column" alignItems="left" spacing={3}>
<ul css={styles.featureList}>
<ul className="m-0 px-6 text-sm font-medium">
<li css={styles.feature}>
<FeatureIcon />
High availability & workspace proxies
Expand All @@ -55,7 +55,7 @@ export const Paywall: FC<PaywallProps> = ({
Unlimited Git & external auth integrations
</li>
</ul>
<div css={styles.learnButton}>
<div className="px-7">
<Button asChild>
<a
href="https://coder.com/pricing#compare-plans"
Expand Down Expand Up @@ -98,36 +98,6 @@ const styles = {
backgroundImage: `linear-gradient(160deg, transparent, ${theme.branding.premium.background})`,
border: `1px solid ${theme.branding.premium.border}`,
}),
title: {
fontWeight: 600,
fontFamily: "inherit",
fontSize: 22,
margin: 0,
},
description: () => ({
fontFamily: "inherit",
maxWidth: 460,
fontSize: 14,
}),
separator: (theme) => ({
width: 1,
height: 220,
backgroundColor: theme.branding.premium.divider,
marginLeft: 8,
}),
learnButton: {
padding: "0 28px",
},
featureList: {
listStyle: "none",
margin: 0,
padding: "0 24px",
fontSize: 14,
fontWeight: 500,
},
featureIcon: (theme) => ({
color: theme.roles.active.fill.outline,
}),
feature: {
display: "flex",
alignItems: "center",
Expand Down
8 changes: 4 additions & 4 deletions site/src/components/SelectMenu/SelectMenu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const meta: Meta<typeof SelectMenu> = {
</SelectMenuButton>
</SelectMenuTrigger>
<SelectMenuContent>
<SelectMenuSearch onChange={() => {}} />
<SelectMenuSearch onChange={() => { }} />
<SelectMenuList>
{opts.map((o) => (
<SelectMenuItem key={o} selected={o === selectedOpt}>
Expand Down Expand Up @@ -76,14 +76,14 @@ export const LongButtonText: Story = {
<SelectMenu>
<SelectMenuTrigger>
<SelectMenuButton
css={{ width: 200 }}
className="w-50"
startIcon={<Avatar size="sm" fallback={selectedOpt} />}
>
{selectedOpt}
</SelectMenuButton>
</SelectMenuTrigger>
<SelectMenuContent>
<SelectMenuSearch onChange={() => {}} />
<SelectMenuSearch onChange={() => { }} />
<SelectMenuList>
{opts.map((o) => (
<SelectMenuItem key={o} selected={o === selectedOpt}>
Expand All @@ -107,7 +107,7 @@ export const NoSelectedOption: Story = {
return (
<SelectMenu>
<SelectMenuTrigger>
<SelectMenuButton css={{ width: 200 }}>All users</SelectMenuButton>
<SelectMenuButton className="w-50">All users</SelectMenuButton>
</SelectMenuTrigger>
<SelectMenuContent>
<SelectMenuSearch onChange={action("search")} />
Expand Down
13 changes: 4 additions & 9 deletions site/src/components/SelectMenu/SelectMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const SelectMenuList: FC<MenuListProps> = (props) => {
return children;
}, [props.children]);
return (
<MenuList css={{ maxHeight: 480 }} {...props}>
<MenuList className="max-h-[480px]" {...props}>
{items}
</MenuList>
);
Expand All @@ -107,23 +107,18 @@ function moveSelectedElementToFirst(items: ReactElement<MenuItemProps>[]) {
}

export const SelectMenuIcon: FC<HTMLProps<HTMLDivElement>> = (props) => {
return <div css={{ marginRight: 16 }} {...props} />;
return <div className="mr-4" {...props} />;
};

export const SelectMenuItem: FC<MenuItemProps> = (props) => {
return (
<MenuItem
css={{
fontSize: 14,
gap: 0,
lineHeight: 1,
padding: `12px ${SIDE_PADDING}px`,
}}
className="text-sm gap-0 leading-none py-3 px-4"
{...props}
>
{props.children}
{props.selected && (
<CheckIcon className="size-icon-xs" css={{ marginLeft: "auto" }} />
<CheckIcon className="size-icon-xs ml-auto" />
)}
</MenuItem>
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const SidebarNavItem: FC<SidebarNavItemProps> = ({
}
>
<Stack alignItems="center" spacing={1.5} direction="row">
<Icon css={{ width: 16, height: 16 }} />
<Icon className="size-4" />
{children}
</Stack>
</NavLink>
Expand Down
7 changes: 3 additions & 4 deletions site/src/components/SyntaxHighlighter/SyntaxHighlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface SyntaxHighlighterProps {
value: string;
language?: string;
editorProps?: ComponentProps<typeof Editor> &
ComponentProps<typeof DiffEditor>;
ComponentProps<typeof DiffEditor>;
compareWith?: string;
}

Expand Down Expand Up @@ -44,9 +44,8 @@ export const SyntaxHighlighter: FC<SyntaxHighlighterProps> = ({
return (
<div
data-chromatic="ignore"
css={{
padding: "8px 0",
height: "100%",
className="py-2 h-full"
style={{
backgroundColor: theme.monaco.colors["editor.background"],
}}
>
Expand Down
8 changes: 1 addition & 7 deletions site/src/components/TableEmpty/TableEmpty.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ export const WithImageAndCta: Story = {
<img
src="/featured/templates.webp"
alt=""
css={{
maxWidth: 800,
height: 320,
overflow: "hidden",
objectFit: "cover",
objectPosition: "top",
}}
className="max-w-3xl h-[320px] overflow-hidden object-cover object-top"
/>
),
style: { paddingBottom: 0 },
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/TableEmpty/TableEmpty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type TableEmptyProps = EmptyStateProps;
export const TableEmpty: FC<TableEmptyProps> = (props) => {
return (
<TableRow>
<TableCell colSpan={999} css={{ padding: "0 !important" }}>
<TableCell colSpan={999} className="p-0!">
<EmptyState {...props} />
</TableCell>
</TableRow>
Expand Down
15 changes: 2 additions & 13 deletions site/src/components/TableToolbar/TableToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ import type { FC, PropsWithChildren } from "react";
export const TableToolbar: FC<PropsWithChildren> = ({ children }) => {
return (
<div
css={(theme) => ({
fontSize: 13,
marginBottom: "8px",
marginTop: 0,
height: "36px", // The size of a small button
color: theme.palette.text.secondary,
display: "flex",
alignItems: "center",
"& strong": {
color: theme.palette.text.primary,
},
})}
className="text-sm mb-2 mt-0 h-9 text-content-secondary flex items-center [&_strong]:text-content-primary"
>
{children}
</div>
Expand All @@ -42,7 +31,7 @@ export const PaginationStatus: FC<PaginationStatusProps> = (props) => {

if (isLoading) {
return (
<div css={{ height: 24, display: "flex", alignItems: "center" }}>
<div className="h-6 flex items-center">
<Skeleton variant="text" width={160} height={16} />
</div>
);
Expand Down
Loading
Loading