Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

feat: Big learning resources panel for dashboard (#2847)

Oleg Isonen01f3f82d93ee
diff --git a/apps/builder/app/builder/features/sidebar-left/help-popover.tsx b/apps/builder/app/builder/features/sidebar-left/help-popover.tsx
index 612a0d9d81..df1f1801d7 100644
--- a/apps/builder/app/builder/features/sidebar-left/help-popover.tsx
+++ b/apps/builder/app/builder/features/sidebar-left/help-popover.tsx
@@ -66,7 +66,7 @@ export const HelpPopover = ({
prefix={<DiscordIcon />}
color="primary"
>
- Chat on Discord
+ Join the Community
</Button>
<Button
formAction="https://github.com/webstudio-is/webstudio-community/discussions"
diff --git a/apps/builder/app/dashboard/card.tsx b/apps/builder/app/dashboard/card.tsx
new file mode 100644
index 0000000000..fc2acb96c5
--- /dev/null
+++ b/apps/builder/app/dashboard/card.tsx
@@ -0,0 +1,40 @@
+import { Flex, theme, Box, Grid, styled } from "@webstudio-is/design-system";
+
+export const Card = styled(Box, {
+ display: "flex",
+ height: "100%",
+ flexDirection: "column",
+ alignItems: "center",
+ flexShrink: 0,
+ overflow: "hidden",
+ aspectRatio: "8 / 7",
+ borderWidth: 1,
+ borderStyle: "solid",
+ borderColor: theme.colors.borderMain,
+ borderRadius: theme.borderRadius[4],
+ background: theme.colors.brandBackgroundProjectCardFront,
+ "&:hover, &:focus-within": {
+ boxShadow: theme.shadows.brandElevationBig,
+ },
+ "&:focus-visible": {
+ outline: `2px solid ${theme.colors.borderFocus}`,
+ },
+});
+
+export const CardContent = styled(Grid, {
+ position: "relative",
+ overflow: "hidden",
+ minWidth: "100%",
+ height: "100%",
+});
+
+export const CardFooter = styled(Flex, {
+ justifyContent: "space-between",
+ flexShrink: 0,
+ alignSelf: "stretch",
+ flexGap: theme.spacing[3],
+ background: theme.colors.brandBackgroundProjectCardTextArea,
+ height: theme.spacing[17],
+ py: theme.spacing[5],
+ px: theme.spacing[7],
+});
diff --git a/apps/builder/app/dashboard/dashboard.tsx b/apps/builder/app/dashboard/dashboard.tsx
index a449a2c51c..8e0b06e044 100644
--- a/apps/builder/app/dashboard/dashboard.tsx
+++ b/apps/builder/app/dashboard/dashboard.tsx
@@ -5,6 +5,8 @@ import type { User } from "~/shared/db/user.server";
import type { DashboardProject } from "@webstudio-is/dashboard";
import { TooltipProvider } from "@radix-ui/react-tooltip";
import type { UserPlanFeatures } from "~/shared/db/user-plan-features.server";
+import { Resources } from "./resources";
+import type { ComponentProps } from "react";
const globalStyles = globalCss({
body: {
@@ -13,6 +15,29 @@ const globalStyles = globalCss({
},
});
+const Main = (props: ComponentProps<typeof Flex>) => {
+ return (
+ <Flex
+ {...props}
+ as="main"
+ direction="column"
+ gap="5"
+ css={{ padding: theme.spacing[13] }}
+ />
+ );
+};
+
+const Section = (props: ComponentProps<typeof Flex>) => {
+ return (
+ <Flex
+ {...props}
+ justify="center"
+ as="section"
+ css={{ minWidth: theme.spacing[33] }}
+ />
+ );
+};
+
type DashboardProps = {
user: User;
projects: Array<DashboardProject>;
@@ -30,15 +55,18 @@ export const Dashboard = ({
return (
<TooltipProvider>
<Header user={user} userPlanFeatures={userPlanFeatures} />
- <main>
- <Flex justify="center" as="section" css={{ minWidth: "min-content" }}>
+ <Main>
+ <Section>
+ <Resources />
+ </Section>
+ <Section>
<Projects
projects={projects}
projectTemplates={projectTemplates}
hasProPlan={userPlanFeatures.hasProPlan}
/>
- </Flex>
- </main>
+ </Section>
+ </Main>
</TooltipProvider>
);
};
diff --git a/apps/builder/app/dashboard/projects/panel.tsx b/apps/builder/app/dashboard/panel.tsx
similarity index 94%
rename from apps/builder/app/dashboard/projects/panel.tsx
rename to apps/builder/app/dashboard/panel.tsx
index 569e85bca9..945da64ca0 100644
--- a/apps/builder/app/dashboard/projects/panel.tsx
+++ b/apps/builder/app/dashboard/panel.tsx
@@ -4,7 +4,6 @@ import type { ComponentProps } from "react";
const panelStyle = css({
background: theme.colors.backgroundPanel,
padding: theme.spacing[13],
- margin: theme.spacing[13],
borderRadius: theme.borderRadius[6],
color: theme.colors.foregroundMain,
minWidth: "min-content",
diff --git a/apps/builder/app/dashboard/projects/empty-state.tsx b/apps/builder/app/dashboard/projects/empty-state.tsx
index ca677b8416..d275c67c60 100644
--- a/apps/builder/app/dashboard/projects/empty-state.tsx
+++ b/apps/builder/app/dashboard/projects/empty-state.tsx
@@ -6,16 +6,9 @@ import {
DialogTrigger,
Flex,
Text,
- theme,
} from "@webstudio-is/design-system";
import { Youtube1cIcon } from "@webstudio-is/icons";
-const containerStyle = css({
- borderRadius: theme.borderRadius[4],
- height: theme.spacing[29],
- minWidth: 600,
-});
-
const contentStyle = css({
maxWidth: "none",
width: "80vw",
@@ -29,14 +22,8 @@ const iframeStyle = css({
});
export const EmptyState = () => (
- <Flex
- align="center"
- justify="center"
- direction="column"
- gap="6"
- className={containerStyle()}
- >
- <Text variant="brandMediumTitle" as="h1">
+ <Flex align="center" justify="center" direction="column" gap="6">
+ <Text variant="brandMediumTitle" as="h1" align="center">
What will you create?
</Text>
<Dialog>
diff --git a/apps/builder/app/dashboard/projects/project-card.tsx b/apps/builder/app/dashboard/projects/project-card.tsx
index d40f9cc628..1a3ec10949 100644
--- a/apps/builder/app/dashboard/projects/project-card.tsx
+++ b/apps/builder/app/dashboard/projects/project-card.tsx
@@ -7,11 +7,9 @@ import {
IconButton,
css,
Flex,
- Grid,
Text,
truncate,
theme,
- Box,
Tooltip,
rawTheme,
Link,
@@ -35,36 +33,7 @@ import {
import { useNavigation } from "@remix-run/react";
import { Spinner } from "../spinner";
import type { DashboardProject } from "@webstudio-is/dashboard";
-
-const containerStyle = css({
- overflow: "hidden",
- aspectRatio: "8 / 7",
- borderWidth: 1,
- borderStyle: "solid",
- borderColor: theme.colors.borderMain,
- borderRadius: theme.borderRadius[4],
- background: theme.colors.brandBackgroundProjectCardBack,
- "&:hover, &:focus-within": {
- boxShadow: theme.shadows.brandElevationBig,
- },
- "&:focus-visible": {
- outline: `2px solid ${theme.colors.borderFocus}`,
- },
-});
-
-const thumbnailStyle = css({
- position: "relative",
- overflow: "hidden",
- minWidth: "100%",
- height: "100%",
-});
-
-const footerStyle = css({
- background: theme.colors.brandBackgroundProjectCardTextArea,
- height: theme.spacing[17],
- py: theme.spacing[5],
- px: theme.spacing[7],
-});
+import { Card, CardContent, CardFooter } from "../card";
const titleStyle = css({
userSelect: "auto",
@@ -216,86 +185,72 @@ export const ProjectCard = ({
// Transition to the project has started, we may need to show a spinner
const isTransitioning = state !== "idle" && linkPath === location.pathname;
return (
- <Box as="article" hidden={isHidden}>
- <Flex
- direction="column"
- align="center"
- shrink={false}
- className={containerStyle()}
- tabIndex={0}
- onKeyDown={handleKeyDown}
+ <Card hidden={isHidden} tabIndex={0} onKeyDown={handleKeyDown}>
+ <CardContent
+ css={{ background: theme.colors.brandBackgroundProjectCardBack }}
>
- <Grid className={thumbnailStyle()}>
- {previewImageAsset ? (
- <ThumbnailLinkWithImage
- to={linkPath}
- name={previewImageAsset.name}
- ref={thumbnailRef}
- />
+ {previewImageAsset ? (
+ <ThumbnailLinkWithImage
+ to={linkPath}
+ name={previewImageAsset.name}
+ ref={thumbnailRef}
+ />
+ ) : (
+ <ThumbnailLinkWithAbbr
+ title={title}
+ to={linkPath}
+ ref={thumbnailRef}
+ />
+ )}
+ {isTransitioning && <Spinner delay={0} />}
+ </CardContent>
+ <CardFooter>
+ <Flex direction="column" justify="around" grow>
+ <Flex gap="1">
+ <Text variant="titles" className={titleStyle()}>
+ {title}
+ </Text>
+ <Tooltip
+ variant="wrapped"
+ content={
+ <Text variant="small">
+ Created on {formatDate(createdAt)}
+ {latestBuild?.publishStatus === "PUBLISHED" && (
+ <>
+ <br />
+ Published on {formatDate(latestBuild.updatedAt)}
+ </>
+ )}
+ </Text>
+ }
+ >
+ <InfoCircleIcon
+ color={rawTheme.colors.foregroundSubtle}
+ tabIndex={-1}
+ className={infoIconStyle()}
+ />
+ </Tooltip>
+ </Flex>
+ {isPublished ? (
+ <PublishedLink domain={domain} tabIndex={-1} />
) : (
- <ThumbnailLinkWithAbbr
- title={title}
- to={linkPath}
- ref={thumbnailRef}
- />
+ <Text color="subtle">Not Published</Text>
)}
- {isTransitioning && <Spinner delay={0} />}
- </Grid>
-
- <Flex
- justify="between"
- shrink={false}
- alignSelf="stretch"
- gap="1"
- className={footerStyle()}
- >
- <Flex direction="column" justify="around">
- <Flex gap="1">
- <Text variant="titles" className={titleStyle()}>
- {title}
- </Text>
- <Tooltip
- variant="wrapped"
- content={
- <Text variant="small">
- Created on {formatDate(createdAt)}
- {latestBuild?.publishStatus === "PUBLISHED" && (
- <>
- <br />
- Published on {formatDate(latestBuild.updatedAt)}
- </>
- )}
- </Text>
- }
- >
- <InfoCircleIcon
- color={rawTheme.colors.foregroundSubtle}
- tabIndex={-1}
- className={infoIconStyle()}
- />
- </Tooltip>
- </Flex>
- {isPublished ? (
- <PublishedLink domain={domain} tabIndex={-1} />
- ) : (
- <Text color="subtle">Not Published</Text>
- )}
- </Flex>
- <Menu
- tabIndex={-1}
- onDelete={() => {
- setIsDeleteDialogOpen(true);
- }}
- onRename={() => {
- setIsRenameDialogOpen(true);
- }}
- onShare={() => {
- setIsShareDialogOpen(true);
- }}
- onDuplicate={handleDuplicate}
- />
</Flex>
- </Flex>
+ <Menu
+ tabIndex={-1}
+ onDelete={() => {
+ setIsDeleteDialogOpen(true);
+ }}
+ onRename={() => {
+ setIsRenameDialogOpen(true);
+ }}
+ onShare={() => {
+ setIsShareDialogOpen(true);
+ }}
+ onDuplicate={handleDuplicate}
+ />
+ </CardFooter>
<RenameProjectDialog
isOpen={isRenameDialogOpen}
onOpenChange={setIsRenameDialogOpen}
@@ -315,7 +270,7 @@ export const ProjectCard = ({
projectId={id}
hasProPlan={hasProPlan}
/>
- </Box>
+ </Card>
);
};
@@ -330,60 +285,46 @@ export const ProjectTemplateCard = ({
const [isDuplicateDialogOpen, setIsDuplicateDialogOpen] = useState(false);
return (
- <Box as="article">
- <Flex
- direction="column"
- align="center"
- shrink={false}
- className={containerStyle()}
- tabIndex={0}
- onKeyDown={handleKeyDown}
+ <Card tabIndex={0} onKeyDown={handleKeyDown}>
+ <CardContent
+ css={{ background: theme.colors.brandBackgroundProjectCardBack }}
>
- <Grid className={thumbnailStyle()}>
- {previewImageAsset ? (
- <ThumbnailWithImage
- name={previewImageAsset.name}
- ref={thumbnailRef}
- onClick={() => {
- setIsDuplicateDialogOpen(true);
- }}
- />
+ {previewImageAsset ? (
+ <ThumbnailWithImage
+ name={previewImageAsset.name}
+ ref={thumbnailRef}
+ onClick={() => {
+ setIsDuplicateDialogOpen(true);
+ }}
+ />
+ ) : (
+ <ThumbnailWithAbbr
+ title={title}
+ ref={thumbnailRef}
+ onClick={() => {
+ setIsDuplicateDialogOpen(true);
+ }}
+ />
+ )}
+ </CardContent>
+ <CardFooter>
+ <Flex direction="column" justify="around">
+ <Text variant="titles" truncate css={{ userSelect: "auto" }}>
+ {title}
+ </Text>
+ {isPublished ? (
+ <PublishedLink domain={domain} tabIndex={-1} />
) : (
- <ThumbnailWithAbbr
- title={title}
- ref={thumbnailRef}
- onClick={() => {
- setIsDuplicateDialogOpen(true);
- }}
- />
+ <Text color="subtle">Not Published</Text>
)}
- </Grid>
-
- <Flex
- justify="between"
- shrink={false}
- alignSelf="stretch"
- gap="1"
- className={footerStyle()}
- >
- <Flex direction="column" justify="around">
- <Text variant="titles" truncate css={{ userSelect: "auto" }}>
- {title}
- </Text>
- {isPublished ? (
- <PublishedLink domain={domain} tabIndex={-1} />
- ) : (
- <Text color="subtle">Not Published</Text>
- )}
- </Flex>
</Flex>
- </Flex>
+ </CardFooter>
<DuplicateProjectDialog
isOpen={isDuplicateDialogOpen}
onOpenChange={setIsDuplicateDialogOpen}
title={title}
projectId={id}
/>
- </Box>
+ </Card>
);
};
diff --git a/apps/builder/app/dashboard/projects/projects.tsx b/apps/builder/app/dashboard/projects/projects.tsx
index bb6e8dd65d..22fbbf132f 100644
--- a/apps/builder/app/dashboard/projects/projects.tsx
+++ b/apps/builder/app/dashboard/projects/projects.tsx
@@ -1,12 +1,9 @@
-import { Button, Flex, Grid, Text } from "@webstudio-is/design-system";
+import { Flex, Grid, Text, rawTheme } from "@webstudio-is/design-system";
import { EmptyState } from "./empty-state";
-import { Panel } from "./panel";
+import { Panel } from "../panel";
import type { DashboardProject } from "@webstudio-is/dashboard";
import { ProjectCard, ProjectTemplateCard } from "./project-card";
import { CreateProject } from "./project-dialogs";
-import { HelpPopover } from "~/builder/features/sidebar-left/help-popover";
-import { HelpIcon } from "@webstudio-is/icons";
-import { useState } from "react";
type ProjectsProps = {
projects: Array<DashboardProject>;
@@ -19,8 +16,6 @@ export const Projects = ({
projectTemplates,
hasProPlan,
}: ProjectsProps) => {
- const [isOpen, setIsOpen] = useState(false);
-
return (
<Panel>
<Flex direction="column" gap="3">
@@ -29,13 +24,6 @@ export const Projects = ({
Projects
</Text>
<Flex gap="2">
- <HelpPopover open={isOpen} onOpenChange={setIsOpen} side="bottom">
- <HelpPopover.Trigger asChild>
- <Button color="neutral" prefix={<HelpIcon size={16} />}>
- Learn More
- </Button>
- </HelpPopover.Trigger>
- </HelpPopover>
<CreateProject />
</Flex>
</Flex>
@@ -43,7 +31,7 @@ export const Projects = ({
<Grid
gap="6"
css={{
- gridTemplateColumns: "repeat(auto-fill, minmax(256px, 1fr))",
+ gridTemplateColumns: `repeat(auto-fill, minmax(${rawTheme.spacing[31]}, 1fr))`,
}}
>
{projects.map((project) => {
@@ -68,7 +56,7 @@ export const Projects = ({
<Grid
gap="6"
css={{
- gridTemplateColumns: "repeat(auto-fill, minmax(256px, 1fr))",
+ gridTemplateColumns: `repeat(auto-fill, minmax(${rawTheme.spacing[31]}, 1fr))`,
}}
>
{projectTemplates.map((project) => {
diff --git a/apps/builder/app/dashboard/resources.tsx b/apps/builder/app/dashboard/resources.tsx
new file mode 100644
index 0000000000..0adf932340
--- /dev/null
+++ b/apps/builder/app/dashboard/resources.tsx
@@ -0,0 +1,103 @@
+import {
+ Flex,
+ Grid,
+ Link,
+ Text,
+ rawTheme,
+ theme,
+} from "@webstudio-is/design-system";
+import { Card, CardContent, CardFooter } from "./card";
+import {
+ DiscordIcon,
+ GithubIcon,
+ Webstudio1cIcon,
+ XIcon,
+ Youtube1cIcon,
+ type IconComponent,
+} from "@webstudio-is/icons";
+import { Panel } from "./panel";
+
+const Resource = ({
+ href,
+ Icon,
+ title,
+}: {
+ href: string;
+ Icon: IconComponent;
+ title: string;
+}) => {
+ return (
+ <Link
+ href={href}
+ target="_blank"
+ underline="none"
+ color="subtle"
+ css={{
+ "&:hover, &:focus-visible": {
+ color: theme.colors.foregroundMain,
+ },
+ }}
+ >
+ <Card>
+ <CardContent>
+ <Flex align="center" justify="center">
+ <Icon size="50%" />
+ </Flex>
+ </CardContent>
+ <CardFooter>
+ <Flex justify="center" align="center" direction="column" grow>
+ <Text variant="titles" align="center" color="main">
+ {title}
+ </Text>
+ </Flex>
+ </CardFooter>
+ </Card>
+ </Link>
+ );
+};
+
+export const Resources = () => {
+ return (
+ <Panel>
+ <Flex direction="column" gap="3">
+ <Flex justify="between">
+ <Text variant="brandSectionTitle" as="h2">
+ Resources
+ </Text>
+ </Flex>
+ <Grid
+ gap="6"
+ css={{
+ gridTemplateColumns: `repeat(auto-fill, minmax(${rawTheme.spacing[23]}, 1fr))`,
+ }}
+ >
+ <Resource
+ href="https://www.youtube.com/playlist?list=PL4vVqpngzeT4sDlanyPe99dYl8BgUYCac"
+ title="Learn with Videos"
+ Icon={Youtube1cIcon}
+ />
+ <Resource
+ href="https://docs.webstudio.is/"
+ title="Read the Docs"
+ Icon={Webstudio1cIcon}
+ />
+ <Resource
+ href="https://discord.gg/UNdyrDkq5r"
+ title="Join the Community"
+ Icon={DiscordIcon}
+ />
+ <Resource
+ href="https://x.com/getwebstudio"
+ title="Follow on X"
+ Icon={XIcon}
+ />
+ <Resource
+ href="https://github.com/webstudio-is/webstudio-community/discussions"
+ title="Discuss on GitHub"
+ Icon={GithubIcon}
+ />
+ </Grid>
+ </Flex>
+ </Panel>
+ );
+};
diff --git a/packages/design-system/src/components/card.tsx b/packages/design-system/src/components/card.tsx
index 66ec25aaea..83f10f938f 100644
--- a/packages/design-system/src/components/card.tsx
+++ b/packages/design-system/src/components/card.tsx
@@ -16,7 +16,7 @@ export const Card = styled("div", {
textDecoration: "none",
color: "inherit",
flexShrink: 0,
- borderRadius: theme.borderRadius[7],
+ borderRadius: theme.borderRadius[5],
position: "relative",
"&::before": {
diff --git a/packages/design-system/src/components/text.ts b/packages/design-system/src/components/text.ts
index f64ad81b97..7a2703c014 100644
--- a/packages/design-system/src/components/text.ts
+++ b/packages/design-system/src/components/text.ts
@@ -4,7 +4,6 @@ import { typography } from "../__generated__/figma-design-tokens";
const normalize = {
userSelect: "none",
- cursor: "default",
} as const;
type Variant = keyof typeof typography;
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index 79fedbdbd7..45310e0d32 100644
--- a/packages/design-system/src/index.ts
+++ b/packages/design-system/src/index.ts
@@ -1,7 +1,7 @@
export * from "./stitches.config";
export * from "./components/storybook";
export * from "./utilities";
-
+export { Slot } from "@radix-ui/react-slot";
// Aligned with Figma
export * from "./components/text";
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index 8730e9cee5..819ed95eb7 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -276,17 +276,6 @@ const {
9: "59px",
},
- /**
- * Use instead: textVariants / textStyles / <Text />
- */
- deprecatedLineHeight: {
- 1: "8px",
- 2: "12px",
- 3: "16px",
- // Legacy - don't use unless specified in Figma
- 4: "20px",
- },
-
borderRadius: {
1: "1px",
2: "2px",
diff --git a/packages/icons/src/types.ts b/packages/icons/src/types.ts
index 586d41cb2b..a39dbce757 100644
--- a/packages/icons/src/types.ts
+++ b/packages/icons/src/types.ts
@@ -7,7 +7,7 @@ import type {
export interface IconProps extends SVGAttributes<SVGElement> {
children?: never;
color?: string;
- size?: number;
+ size?: number | string;
}
export type IconComponent = ForwardRefExoticComponent<