Skip to content

refactor(site): improve templates empty state #10518

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

Merged
merged 11 commits into from
Nov 6, 2023
Prev Previous commit
Next Next commit
Minor improvements
  • Loading branch information
BrunoQuaresma committed Nov 3, 2023
commit d8987b9fe48879397f958c9765ffb944fefff9a9
13 changes: 6 additions & 7 deletions site/src/components/TemplateExampleCard/TemplateExampleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import Button from "@mui/material/Button";
import Link from "@mui/material/Link";
import type { TemplateExample } from "api/typesGenerated";
import { Pill } from "components/Pill/Pill";
import { type FC } from "react";
import { HTMLProps } from "react";
import { Link as RouterLink } from "react-router-dom";

export interface TemplateExampleCardProps {
type TemplateExampleCardProps = {
example: TemplateExample;
activeTag?: string;
}
} & HTMLProps<HTMLDivElement>;

export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
example,
activeTag,
}) => {
export const TemplateExampleCard = (props: TemplateExampleCardProps) => {
const { example, activeTag, ...divProps } = props;
return (
<div
css={(theme) => ({
Expand All @@ -27,6 +25,7 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
display: "flex",
flexDirection: "column",
})}
{...divProps}
>
<div
css={{
Expand Down
14 changes: 7 additions & 7 deletions site/src/pages/StarterTemplatesPage/StarterTemplatesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({

{Boolean(!starterTemplatesByTag) && <Loader />}

<Stack direction="row" spacing={4}>
<Stack direction="row" spacing={4} alignItems="flex-start">
{starterTemplatesByTag && tags && (
<Stack css={styles.filter}>
<Stack
css={{ width: 208, flexShrink: 0, position: "sticky", top: 48 }}
>
<span css={styles.filterCaption}>Filter</span>
{tags.map((tag) => (
<Link
Expand Down Expand Up @@ -90,6 +92,9 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({
{visibleTemplates &&
visibleTemplates.map((example) => (
<TemplateExampleCard
css={(theme) => ({
backgroundColor: theme.palette.background.paper,
})}
example={example}
key={example.id}
activeTag={activeTag}
Expand All @@ -102,11 +107,6 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({
};

const styles = {
filter: (theme) => ({
width: theme.spacing(26),
flexShrink: 0,
}),

filterCaption: (theme) => ({
textTransform: "uppercase",
fontWeight: 600,
Expand Down