Skip to content

figma-inspector: added some UX to the revamped dialog #8321

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
59 changes: 41 additions & 18 deletions tools/figma-inspector/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getColorTheme, subscribeColorTheme } from "./utils/bolt-utils";
import CodeSnippet from "./components/snippet/CodeSnippet";
import { ExportType, useInspectorStore } from "./utils/store";
import DialogFrame from "./components/DialogFrame.js";
import { Button, Checkbox, DropdownMenu, Text } from "figma-kit";
import { Text, Button, Checkbox, DropdownMenu } from "figma-kit";
import "./main.css";

export const App = () => {
Expand Down Expand Up @@ -102,40 +102,63 @@ export const App = () => {
/>
</DialogFrame.Content>
<DialogFrame.Footer>
<div className="border border-secondary border-[var(--figma-color-bg-brand)]">
<Text className="text-[var(--figma-color-bg-brand)]">
Welcome to Figma
</Text>
</div>
<Checkbox.Root>
<Checkbox.Input
checked={useVariables}
onChange={(e) => setUseVariables(e.target.checked)}
/>
<Checkbox.Label>Use Figma Variables</Checkbox.Label>
</Checkbox.Root>

<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
<Button>Export</Button>
<Button
variant={
exportsAreCurrent ? "secondary" : "primary"
}
style={{
visibility: useVariables
? "visible"
: "hidden",
}}
>
Export
</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content style={{}}>
<DropdownMenu.Content>
<DropdownMenu.Item
onClick={() =>
exportFiles(ExportType.SeparateFiles)
}
>
Separate Files…
Separate Files Per Collection
</DropdownMenu.Item>
<DropdownMenu.Item
onClick={() =>
exportFiles(ExportType.SingleFile)
}
>
Single File…
Single Design-Tokens File…
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>

<Checkbox.Root>
<Checkbox.Input
checked={useVariables}
onChange={(e) => setUseVariables(e.target.checked)}
/>
<Checkbox.Label>Use Figma Variables</Checkbox.Label>
</Checkbox.Root>
<Text
style={{
color: exportsAreCurrent
? "var(--figma-color-text-disabled)"
: "var(--figma-color-text-primary",
}}
>
{useVariables ? (
exportsAreCurrent ? (
<em>Exports are current</em>
) : (
"Either variables have changed or no export found"
)
) : (
""
)}
</Text>
</DialogFrame.Footer>
</DialogFrame>
</>
Expand Down