Skip to content

Commit

Permalink
experimental: add more hints about css variables (#4282)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound authored Oct 14, 2024
1 parent 11f5450 commit 0e71255
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ScrollArea,
SmallIconButton,
styled,
Text,
theme,
toast,
Tooltip,
Expand All @@ -26,7 +27,11 @@ import {
WsComponentMeta,
} from "@webstudio-is/react-sdk";
import { ROOT_INSTANCE_ID, type Instance } from "@webstudio-is/sdk";
import { EyeconClosedIcon, EyeconOpenIcon } from "@webstudio-is/icons";
import {
EyeconClosedIcon,
EyeconOpenIcon,
InfoCircleIcon,
} from "@webstudio-is/icons";
import {
$dragAndDropState,
$editingItemSelector,
Expand Down Expand Up @@ -476,6 +481,21 @@ export const NavigatorTree = () => {
onClick: () => $selectedInstanceSelector.set([ROOT_INSTANCE_ID]),
onFocus: () => $selectedInstanceSelector.set([ROOT_INSTANCE_ID]),
}}
action={
<Tooltip
variant="wrapped"
side="bottom"
disableHoverableContent={true}
content={
<Text>
Variables defined on Global Root are available on every
instance on every page.
</Text>
}
>
<InfoCircleIcon />
</Tooltip>
}
>
<TreeNodeLabel prefix={<MetaIcon icon={rootMeta.icon} />}>
{rootMeta.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const AdvancedSearch = ({
itemToString={(item) => item?.label ?? ""}
getItemProps={() => ({ text: "sentence" })}
getDescription={(item) => {
let description = `Unknown CSS property.`;
let description = `Create CSS variable.`;
if (item && item.value in propertyDescriptions) {
description =
propertyDescriptions[
Expand Down Expand Up @@ -201,7 +201,7 @@ const AdvancedPropertyLabel = ({ property }: { property: StyleProperty }) => {
}}
content={
<PropertyInfo
title={label}
title={property.startsWith("--") ? "CSS Variable" : label}
description={description}
styles={[styleDecl]}
onReset={() => {
Expand Down

0 comments on commit 0e71255

Please sign in to comment.