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.

chore: More dashboard improvements (#2854)

Oleg Isonene77a8f5180cb
diff --git a/apps/builder/app/dashboard/resources/resources.tsx b/apps/builder/app/dashboard/resources/resources.tsx
index db301e6d95..f81efb1e09 100644
--- a/apps/builder/app/dashboard/resources/resources.tsx
+++ b/apps/builder/app/dashboard/resources/resources.tsx
@@ -10,7 +10,6 @@ import {
import {
DiscordIcon,
GithubIcon,
- Webstudio1cIcon,
XIcon,
Youtube1cIcon,
type IconComponent,
@@ -21,18 +20,25 @@ import { Panel } from "../shared/panel";
import { IntroVideoDialog } from "./intro-video";
import introThumb from "./intro-thumb.jpg";
+const introButtonStyle = css({
+ "&:hover, &:focus-visible": {
+ "--ws-resource-intro-video-filter": "none",
+ },
+});
+
const introThumbStyle = css({
width: "100%",
height: "100%",
objectFit: "cover",
objectPosition: "center",
+ filter: "var(--ws-resource-intro-video-filter, brightness(80%))",
});
const IntroVideoCard = () => {
return (
<IntroVideoDialog asChild>
<Card asChild>
- <button>
+ <button className={introButtonStyle()}>
<CardContent>
<Flex align="center" justify="center">
<img src={introThumb} className={introThumbStyle()} />
@@ -52,54 +58,37 @@ const IntroVideoCard = () => {
};
const resourceIconSyle = css({
- display: "var(--ws-resource-icon-default-display, block)",
- color: `var(--ws-resource-icon-selected-color, ${theme.colors.foregroundSubtle})`,
width: "35%",
height: "auto",
- variants: {
- variant: {
- selected: {
- display: "var(--ws-resource-icon-selected-display, none)",
- },
- },
- },
+ filter: "var(--ws-resource-icon-filter, opacity(0.8) brightness(80%))",
});
const Resource = ({
href,
Icon,
- SelectedIcon,
title,
- selectedColor = theme.colors.foregroundMain,
+ color,
}: {
href: string;
Icon: IconComponent;
- SelectedIcon?: IconComponent;
title: string;
- selectedColor?: string;
+ color?: string;
}) => {
- SelectedIcon || (SelectedIcon = Icon);
return (
<Card asChild>
<Link
href={href}
target="_blank"
underline="none"
- color="subtle"
css={{
"&:hover, &:focus-visible": {
- "--ws-resource-icon-selected-color": selectedColor,
- "--ws-resource-icon-selected-display": "block",
- "--ws-resource-icon-default-display": "none",
+ "--ws-resource-icon-filter": "none",
},
}}
>
<CardContent>
<Flex align="center" justify="center">
- <Icon className={resourceIconSyle()} />
- <SelectedIcon
- className={resourceIconSyle({ variant: "selected" })}
- />
+ <Icon className={resourceIconSyle({ css: { color } })} />
</Flex>
</CardContent>
<CardFooter>
@@ -134,29 +123,30 @@ export const Resources = () => {
href="https://www.youtube.com/playlist?list=PL4vVqpngzeT4sDlanyPe99dYl8BgUYCac"
title="Learn with Videos"
Icon={Youtube1cIcon}
- selectedColor="#FF0000"
+ color="#FF0000"
/>
<Resource
href="https://docs.webstudio.is/"
title="Read the Docs"
- Icon={Webstudio1cIcon}
- SelectedIcon={WebstudioIcon}
+ Icon={WebstudioIcon}
/>
<Resource
href="https://discord.gg/UNdyrDkq5r"
title="Join the Community"
- selectedColor="#5865F2"
Icon={DiscordIcon}
+ color="#5865F2"
/>
<Resource
href="https://x.com/getwebstudio"
title="Follow on X"
Icon={XIcon}
+ color={theme.colors.foregroundMain}
/>
<Resource
href="https://github.com/webstudio-is/webstudio-community/discussions"
title="Discuss on GitHub"
Icon={GithubIcon}
+ color={theme.colors.foregroundMain}
/>
</Grid>
</Flex>
diff --git a/apps/builder/app/dashboard/shared/card.tsx b/apps/builder/app/dashboard/shared/card.tsx
index 2e5396a824..20c938c118 100644
--- a/apps/builder/app/dashboard/shared/card.tsx
+++ b/apps/builder/app/dashboard/shared/card.tsx
@@ -8,7 +8,7 @@ import {
Slot,
type SlotProps,
} from "@webstudio-is/design-system";
-import type { ComponentProps } from "react";
+import { forwardRef, type ComponentProps } from "react";
const cardStyle = css({
display: "flex",
@@ -33,14 +33,17 @@ const cardStyle = css({
},
});
-type CardProps = ComponentProps<typeof Box> & {
+type CardProps = ComponentProps<"div"> & {
asChild?: boolean;
} & SlotProps;
-export const Card = ({ asChild, ...props }: CardProps) => {
- const Component = asChild ? Slot : Box;
- return <Component {...props} className={cardStyle()} />;
-};
+export const Card = forwardRef<HTMLDivElement, CardProps>(
+ ({ asChild, ...props }, ref) => {
+ const Component = asChild ? Slot : Box;
+ return <Component {...props} className={cardStyle()} ref={ref} />;
+ }
+);
+Card.displayName = "Card";
export const CardContent = styled(Grid, {
position: "relative",
diff --git a/apps/builder/app/dashboard/shared/spinner/spinner.tsx b/apps/builder/app/dashboard/shared/spinner/spinner.tsx
index 9bd3b1ea30..690ccb6b93 100644
--- a/apps/builder/app/dashboard/shared/spinner/spinner.tsx
+++ b/apps/builder/app/dashboard/shared/spinner/spinner.tsx
@@ -21,7 +21,10 @@ export const Spinner = ({
size?: number;
}) => {
const [isVisible, setIsVisible] = useDebounce(false, delay);
- setIsVisible(true);
+
+ if (delay !== 0) {
+ setIsVisible(true);
+ }
if (isVisible === false) {
return null;