Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
fix: wrap stepback in metadata item
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackarySantana committed Mar 21, 2024
1 parent 7b50505 commit efde83b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
9 changes: 8 additions & 1 deletion src/components/MetadataCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApolloError } from "@apollo/client";
import styled from "@emotion/styled";
import { PolymorphicAs } from "@leafygreen-ui/polymorphic";
import { Body, BodyProps } from "@leafygreen-ui/typography";
import { Skeleton } from "antd";
import { ErrorWrapper } from "components/ErrorWrapper";
Expand Down Expand Up @@ -39,14 +40,20 @@ export const MetadataTitle: React.FC<{ children: React.ReactNode }> = ({
);

interface ItemProps {
as?: PolymorphicAs;
children: React.ReactNode;
"data-cy"?: string;
}

export const MetadataItem: React.FC<ItemProps> = ({
as = "p",
children,
"data-cy": dataCy,
}) => <Item data-cy={dataCy}>{children}</Item>;
}) => (
<Item data-cy={dataCy} as={as}>
{children}
</Item>
);

const Title = styled(Body)<BodyProps>`
font-size: 15px;
Expand Down
25 changes: 15 additions & 10 deletions src/pages/task/metadata/Stepback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Badge from "@leafygreen-ui/badge";
import { InfoSprinkle } from "@leafygreen-ui/info-sprinkle";
import { Skeleton } from "@leafygreen-ui/skeleton-loader";
import { BaseFontSize } from "@leafygreen-ui/tokens";
import { MetadataItem } from "components/MetadataCard";
import { size } from "constants/tokens";
import { TaskQuery } from "gql/generated/types";
import { useBreakingTask } from "hooks/useBreakingTask";
Expand Down Expand Up @@ -44,16 +45,20 @@ export const Stepback: React.FC<Props> = ({ taskId }) => {
const finished = breakingTask !== undefined || isBreakingTask;

return (
<StepbackWrapper>
Stepback:
<InfoSprinkle baseFontSize={BaseFontSize.Body1}>
When Stepback is completed you can access the breaking commit via the
relevant commits dropdown.
</InfoSprinkle>
{loading && <Skeleton size="small" />}
{!loading && !finished && <Badge variant="lightgray">In progress</Badge>}
{!loading && finished && <Badge variant="green">Complete</Badge>}
</StepbackWrapper>
<MetadataItem as="div">
<StepbackWrapper>
Stepback:
<InfoSprinkle baseFontSize={BaseFontSize.Body1}>
When Stepback is completed you can access the breaking commit via the
relevant commits dropdown.
</InfoSprinkle>
{loading && <Skeleton size="small" />}
{!loading && !finished && (
<Badge variant="lightgray">In progress</Badge>
)}
{!loading && finished && <Badge variant="green">Complete</Badge>}
</StepbackWrapper>
</MetadataItem>
);
};

Expand Down

0 comments on commit efde83b

Please sign in to comment.