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

feat(slice-machine): add OwnerSelect in FieldSet's stories #1276

Merged
merged 1 commit into from
Jan 29, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import {
Button,
ButtonGroup,
IconButton,
Select,
SelectItem,
Skeleton,
Text,
tokens,
} from "@prismicio/editor-ui";
import type { Meta, StoryObj } from "@storybook/react";
import type { ReactNode } from "react";

import { BitbucketIcon } from "../../icons/BitbucketIcon";
import { GitHubIcon } from "../../icons/GitHubIcon";
Expand Down Expand Up @@ -105,7 +108,9 @@ export const LoadingWithHeaderAndList = {
children: (
<>
<FieldSetLegend>Connected Git Repository</FieldSetLegend>
<FieldSetHeader />
<FieldSetHeader>
<OwnerSelect disabled />
</FieldSetHeader>
<FieldSetList>
{[...Array(4).keys()].map((index) => (
<FieldSetListItem
Expand Down Expand Up @@ -137,7 +142,9 @@ export const WithHeaderAndListOverflow = {
children: (
<>
<FieldSetLegend>Connected Git Repository</FieldSetLegend>
<FieldSetHeader />
<FieldSetHeader>
<OwnerSelect />
</FieldSetHeader>
<FieldSetList>
{[...Array(100).keys()].map((index) => (
<FieldSetListItem
Expand Down Expand Up @@ -177,12 +184,15 @@ export const WithSingleListItem = {
parameters: { controls: { hideNoControlsWarning: true, include: [] } },
};

export const WithBoxContent = {
export const WithHeaderAndBoxContent = {
args: {
...Default.args,
children: (
<>
<FieldSetLegend>Connected Git Repository</FieldSetLegend>
<FieldSetHeader>
<OwnerSelect />
</FieldSetHeader>
<FieldSetContent>
{/*
* TODO: these `padding` values actually don't match Figma, but they
Expand All @@ -206,3 +216,27 @@ export const WithBoxContent = {
},
parameters: { controls: { hideNoControlsWarning: true, include: [] } },
};

type OwnerSelectProps = { disabled?: boolean };

function OwnerSelect(props: OwnerSelectProps): ReactNode {
return (
<Select
{...props}
color="grey"
constrainContentWidth
flexContent
placeholder="Owner"
renderStartIcon={() => <GitHubIcon color={tokens.color.greyLight11} />}
Copy link
Member

Choose a reason for hiding this comment

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

The icon appears further away from the text than it should. I saw you opened a thread here: Open Slack

Will we eventually change <Select> to use a smaller gap?

Copy link
Collaborator Author

@bapmrl bapmrl Jan 29, 2024

Choose a reason for hiding this comment

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

I hope soon, but the conversation involves several team members with different priorities 😄

size="large"
sx={{ width: "calc(50% - 8px)" }}
>
<SelectItem size="large" value="owner-1">
Owner
</SelectItem>
<SelectItem size="large" value="owner-2">
Owner
</SelectItem>
</Select>
);
}
Loading