Skip to content
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

Playground style updates #3182

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d2a2114
Improving Playground styles, added IconByName in UI
OAGr Apr 15, 2024
5a3a655
Thinner chevron icons
OAGr Apr 15, 2024
d6abd41
Merge branch 'main' of https://github.com/quantified-uncertainty/squi…
OAGr Apr 15, 2024
69eba71
Light color changes
OAGr Apr 15, 2024
e341ca3
Merged with squigglechart-path-fix
OAGr Apr 15, 2024
be4f0b3
Better pass at version picker button
OAGr Apr 15, 2024
53be9aa
green -> emerald
OAGr Apr 15, 2024
0adb271
Merge branch 'style-updates-april-2024' into playground-style-updates
OAGr Apr 15, 2024
af1e68b
Merge branch 'style-updates-april-2024' into playground-style-updates
OAGr Apr 16, 2024
1fc00c6
Merge branch 'style-updates-april-2024' into playground-style-updates
OAGr Apr 16, 2024
bdd8a67
Ran formatter, fixed other linter errors
OAGr Apr 16, 2024
e42196c
Minor fixes
OAGr Apr 16, 2024
e2b8d18
Minor touch-ups to playground colors
OAGr Apr 17, 2024
35ac262
SquiggleViewer to use cyan instead of purple
OAGr Apr 17, 2024
e6188a8
Adjustments in ui colors. Slate->gray, indigo->blue
OAGr Apr 17, 2024
bb076cf
Added StyledToggle, some refactoring
OAGr Apr 17, 2024
363a0dd
Changing version picker
OAGr Apr 17, 2024
013c8c6
Removed StyledToggle export from UI, as it was stopping Hub building
OAGr Apr 17, 2024
c434140
Integrated SquigglePlaygroundVersionPickerDropdown
OAGr Apr 17, 2024
0cfd698
Version picker cleanup
OAGr Apr 17, 2024
a80f79d
Merge branch 'style-updates-april-2024' into playground-style-updates
OAGr Apr 17, 2024
59e7bc1
Added changeset
OAGr Apr 17, 2024
283f9b5
Minor reversion and fixes
OAGr Apr 24, 2024
0da0523
Merge branch 'main' into playground-style-updates
OAGr Apr 24, 2024
db6de0c
Added lint override for stories
OAGr Apr 24, 2024
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
7 changes: 7 additions & 0 deletions .changeset/fresh-rings-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@quri/versioned-squiggle-components": patch
"@quri/squiggle-components": patch
"@quri/ui": patch
---

Updated playground styles to look more professional, added StyledToggle
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ class FocusableMarker extends GutterMarker {
<div
className={clsx(
// initial color, specialized for active lines
"bg-violet-50 [.cm-activeLineGutter_&]:bg-white",
"bg-gray-100 [.cm-activeLineGutter_&]:bg-white",
// highlight all markers on gutter hover; highlight the hovered markers even more
"group-hover/gutter:bg-violet-200 group-hover/marker:!bg-violet-400",
"br-1 mt-[1px] h-4 w-[3px] rounded-sm",
"group-hover/gutter:bg-gray-200 group-hover/marker:!bg-gray-500",
"br-1 mt-[1px] h-4 w-[4px] rounded-sm",
"transition duration-75"
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/SquiggleEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const SquiggleEditor: FC<SquiggleEditorProps> = ({
return (
<div>
<div
className="rounded-sm border border-slate-300 bg-slate-50 p-2"
className="rounded-sm border border-gray-200 bg-gray-50 p-2"
data-testid="squiggle-editor"
>
<CodeEditor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import {
import { SqProject } from "@quri/squiggle-lang";
import {
AdjustmentsVerticalIcon,
Bars3CenterLeftIcon,
CurlyBracketsIcon,
Dropdown,
DropdownMenu,
DropdownMenuActionItem,
PuzzleIcon,
TriangleIcon,
} from "@quri/ui";

import { isSimulating, Simulation } from "../../../lib/hooks/useSimulator.js";
Expand Down Expand Up @@ -98,9 +97,11 @@ export const LeftPlaygroundPanel = forwardRef<LeftPlaygroundPanelHandle, Props>(
/>
<ToolbarItem
tooltipText={`Format Code (${altKey()}+Shift+f)`}
icon={Bars3CenterLeftIcon}
icon={CurlyBracketsIcon}
onClick={editorRef.current?.format}
/>
>
Format
</ToolbarItem>
<Dropdown
render={() => (
<DropdownMenu>
Expand All @@ -118,9 +119,7 @@ export const LeftPlaygroundPanel = forwardRef<LeftPlaygroundPanelHandle, Props>(
</DropdownMenu>
)}
>
<ToolbarItem icon={TriangleIcon} iconClasses="rotate-180">
Menu
</ToolbarItem>
<ToolbarItem showDropdownArrow>Menu</ToolbarItem>
</Dropdown>
<div className="flex-1">
{props.renderExtraControls?.({ openModal })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const ResizableTwoPanelLayout: FC<Props> = ({
>
<div
ref={handleRef}
className="absolute top-0 h-full cursor-ew-resize border-l border-slate-300 transition hover:border-blue-500"
className="absolute top-0 h-full cursor-ew-resize border-l border-slate-200 transition hover:border-blue-500"
style={{ width: 5, right: -5 }}
/>
</DraggableCore>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const SquigglePlayground: React.FC<SquigglePlaygroundProps> = (
} else {
return (
<div className="grid h-full place-items-center">
<RefreshIcon className="animate-spin text-slate-400" size={24} />
<RefreshIcon className="animate-spin text-gray-400" size={24} />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ type StandardProps = {
title?: string;
color?: string;
textSize?: string;
font?: string;
icon?: JSX.Element;
showColon?: boolean;
hasEdges?: boolean;
isFocusEnabled?: boolean;
};

Expand All @@ -51,18 +50,18 @@ const getStandardProps = (props: TitleProps): StandardProps => {
viewerType === "tooltip" && { isFocusEnabled: false },
valuePath.edges.length > 1 && {
color: "text-teal-700",
showColon: true,
hasEdges: true,
},
headerVisibility === "large" && {
color: "text-stone-700",
textSize: "text-md font-bold",
showColon: false,
hasEdges: false,
isFocusEnabled: false,
},
isRoot && {
color: "text-stone-500",
textSize: "text-sm font-semibold",
showColon: false,
hasEdges: false,
isFocusEnabled: false,
},
parentValue?.tag === "Array" &&
Expand All @@ -71,13 +70,12 @@ const getStandardProps = (props: TitleProps): StandardProps => {
},
taggedName && {
title: taggedName,
font: "font-sans",
},
isRootImport && {
title: exportData?.sourceId || undefined,
color: "text-violet-900",
icon: <CodeBracketIcon size={12} className="mr-1 text-violet-900" />,
showColon: false,
color: "text-cyan-600",
icon: <CodeBracketIcon size={12} className="mr-1 text-cyan-600" />,
hasEdges: false,
},
]);

Expand All @@ -91,32 +89,30 @@ export const Title: FC<TitleProps> = (props) => {
title = pathToShortName(valuePath),
color = "text-orange-900",
icon = undefined,
showColon = false,
hasEdges = false,
isFocusEnabled = true,
textSize = "text-sm",
font = "font-mono",
} = standards;

return (
<div
className={clsx(
"flex flex-row items-center leading-3",
showColon && "mr-3"
hasEdges && "mr-3"
)}
>
{icon}
<div
className={clsx(
color,
textSize,
font,
"font-mono",
isFocusEnabled && "cursor-pointer hover:underline"
)}
onClick={() => isFocusEnabled && zoomIn(valuePath)}
>
{title}
</div>
{showColon && <div className="font-mono text-gray-400">:</div>}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of colon makes it harder to interpret the results:
Screenshot 2024-04-25 at 17 47 54

In general, I'm concerned about optimizing UI by removing things that are visual cruft when you're an expert at the playground and understand which element is which, but that were very helpful for people who don't understand yet what's going on.

This specific case is minor, though, and I'd prefer that we wrap array indices in [] instead of using colons. Also it's less of a problem than this (which is a problem both in this PR and before):
Screenshot 2024-04-25 at 17 51 30

</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export const ValueWithContextViewer: FC<Props> = ({
return (
<div
className={clsx(
"mr-1.5 flex w-4 cursor-pointer justify-center hover:!text-stone-600",
isOpen ? "text-stone-600 opacity-40" : "text-stone-800 opacity-40"
"mr-1.5 flex w-4 cursor-pointer justify-center hover:!text-gray-600",
isOpen ? "text-gray-200" : "text-gray-500"
)}
onClick={handle.toggleCollapsed}
>
<Icon size={13} />
<Icon size={9} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clickable area is now 16x9, while it was 16x13 in v0.9.3. If the icon is smaller now, is it possible to add vertical padding to the clickable div around it?

</div>
);
} else {
Expand All @@ -158,7 +158,7 @@ export const ValueWithContextViewer: FC<Props> = ({
className="group flex w-4 shrink-0 cursor-pointer justify-center"
onClick={handle.toggleCollapsed}
>
<div className="w-px bg-stone-100 group-hover:bg-stone-400" />
<div className="w-px bg-gray-50 group-hover:bg-gray-300" />
</div>
);
} else {
Expand All @@ -178,10 +178,8 @@ export const ValueWithContextViewer: FC<Props> = ({
}}
tabIndex={viewerType === "tooltip" ? undefined : 0}
className={clsx(
"group flex justify-between rounded-sm pr-0.5 hover:bg-stone-100 focus-visible:outline-none",
isZoomedIn
? "mb-2 px-0.5 py-1 focus:bg-indigo-50"
: "focus:bg-indigo-100"
"group flex justify-between rounded-sm pr-0.5 hover:bg-gray-100 focus:bg-slate-100 focus-visible:outline-none",
isZoomedIn && "mb-2 px-0.5 py-1"
)}
onFocus={(_) => {
scrollEditorToPath();
Expand Down Expand Up @@ -239,7 +237,7 @@ export const ValueWithContextViewer: FC<Props> = ({
className={clsx(
"cursor-pointer transition",
isRootImport
? "text-violet-400 hover:!text-violet-900 group-hover:text-violet-500 group-focus:text-violet-600"
? "text-cyan-200 hover:!text-cyan-900 group-hover:text-cyan-700 group-focus:text-cyan-700"
: "text-slate-200 hover:!text-slate-900 group-hover:text-slate-400 group-focus:text-slate-400"
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const ZoomedInNavigationItem: FC<{
>
{text}
</span>
<ChevronRightIcon className="text-slate-300" size={24} />
<span className="px-1">
<ChevronRightIcon className="text-gray-300" size={14} />
</span>
</div>
);

Expand All @@ -32,7 +34,7 @@ export const ZoomedInNavigation: FC<{
: zoomedInPath.allPrefixPaths();

return (
<div className="flex items-center">
<div className="mt-1 flex items-center">
<ZoomedInNavigationItem onClick={zoomOut} text="Home" />

{/* We remove the last element, because it's the one being shown */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ export const Layout: FC<{
<div className="flex flex-col overflow-y-auto">
<div
className={clsx(
`mb-1 flex h-8 items-center justify-between`,
`mb-1 flex h-8 items-center justify-between overflow-hidden border-b border-gray-200`,
`px-${xPadding}`
)}
>
{menu}
<div className="grid h-full place-items-stretch">{menu}</div>
<div className="flex items-center">
{indicator}
{changeSeedAndRunButton}
</div>
</div>

<div
className="flex-1 overflow-auto px-2 pb-1"
data-testid="dynamic-viewer-result"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const DiceIcon: FC<{ side: number; isSimulating: boolean }> = ({
isSimulating,
}) => {
const props = {
size: 16,
size: 14,
className: clsx(
isSimulating
? "animate-spin text-violet-400 group-hover:text-violet-900"
: "text-violet-200 group-hover:text-violet-500"
? "animate-spin text-gray-500 group-hover:text-gray-600"
: "text-gray-300 group-hover:text-gray-600"
),
};
switch (side) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export const SimulatingIndicator: FC<{
return (
<div
className={clsx(
"whitespace-nowrap text-sm",
_isSimulating ? "text-zinc-200" : "text-zinc-400"
"whitespace-nowrap text-sm font-light",
_isSimulating ? "text-gray-200" : "text-gray-500"
)}
>
{`simulation #${simulation.executionId} in ${showTime(
{`Simulation #${simulation.executionId} in ${showTime(
simulation.executionTime
)}`}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import clsx from "clsx";
import { FC } from "react";

import {
Button,
CodeBracketIcon,
Dropdown,
DropdownMenu,
DropdownMenuActionItem,
DropdownMenuHeader,
TriangleIcon,
} from "@quri/ui";

import { SqOutputResult } from "../../../../squiggle-lang/src/public/types.js";
import { SelectableViewerTab, ViewerTab } from "../../lib/utility.js";
import { ToolbarItem } from "../ui/PanelWithToolbar/ToolbarItem.js";

const MenuItemTitle: FC<{ title: string; type: string | null }> = ({
title,
Expand All @@ -21,11 +19,11 @@ const MenuItemTitle: FC<{ title: string; type: string | null }> = ({
const isEmpty = type === null;
return (
<div className="flex justify-between">
<span className={clsx(isEmpty && "text-slate-400")}>{title}</span>
<span className={clsx(isEmpty && "text-gray-400")}>{title}</span>
{isEmpty ? (
<span className="text-slate-300">Empty</span>
<span className="text-gray-300">Empty</span>
) : (
<span className="text-blue-800">{type}</span>
<span className="text-gray-400">{type}</span>
)}
</div>
);
Expand Down Expand Up @@ -78,12 +76,27 @@ export const ViewerMenu: FC<Props> = ({
return null;
}
};
const viewerName = () => {
switch (tab) {
case "Imports":
return "Imports";
case "Variables":
return "Local Variables";
case "Exports":
return "Exported Variables";
case "Result":
return "Final Result";
default:
return "";
}
};
return (
tab !== "AST" && (
<DropdownMenuActionItem
key={tab}
icon={CodeBracketIcon}
title={<MenuItemTitle title={tab} type={getType()} />}
title={
<MenuItemTitle title={viewerName()} type={getType()} />
}
onClick={() => {
setViewerTab(tab);
close();
Expand All @@ -94,7 +107,6 @@ export const ViewerMenu: FC<Props> = ({
})}
<DropdownMenuHeader>Debugging</DropdownMenuHeader>
<DropdownMenuActionItem
icon={CodeBracketIcon}
title={<MenuItemTitle title="AST" type="" />}
onClick={() => {
setViewerTab("AST");
Expand All @@ -104,12 +116,7 @@ export const ViewerMenu: FC<Props> = ({
</DropdownMenu>
)}
>
<Button size="small">
<div className="flex items-center space-x-1.5">
<span>{viewerTabTitle(viewerTab)}</span>
<TriangleIcon className="rotate-180 text-slate-400" size={10} />
</div>
</Button>
<ToolbarItem showDropdownArrow>{viewerTabTitle(viewerTab)}</ToolbarItem>
</Dropdown>
);
};
8 changes: 4 additions & 4 deletions packages/components/src/components/ui/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ export const SuccessAlert: React.FC<{
}> = (props) => (
<Alert
{...props}
backgroundColor="bg-green-50"
headingColor="text-green-800"
bodyColor="text-green-700"
backgroundColor="bg-emerald-50"
headingColor="text-emerald-800"
bodyColor="text-emerald-700"
icon={CheckCircleIcon}
iconColor="text-green-400"
iconColor="text-emerald-400"
/>
);
Loading
Loading