-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVPROD-10196: Render Inactive Commits Button and Modal in Waterfall (#…
…426)
- Loading branch information
Showing
15 changed files
with
508 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
apps/spruce/src/pages/waterfall/InactiveVersionsButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { useState } from "react"; | ||
import styled from "@emotion/styled"; | ||
import Button from "@leafygreen-ui/button"; | ||
import { palette } from "@leafygreen-ui/palette"; | ||
import pluralize from "pluralize"; | ||
import { DisplayModal } from "components/DisplayModal"; | ||
import Icon from "components/Icon"; | ||
import { size } from "constants/tokens"; | ||
import { WaterfallQuery } from "gql/generated/types"; | ||
import { VersionLabel } from "../VersionLabel"; | ||
|
||
const { gray } = palette; | ||
interface Props { | ||
versions: WaterfallQuery["waterfall"]["versions"][0]["inactiveVersions"]; | ||
containerHeight: number | undefined; | ||
} | ||
export const InactiveVersionsButton: React.FC<Props> = ({ | ||
containerHeight, | ||
versions, | ||
}) => { | ||
const [modalOpen, setModalOpen] = useState(false); | ||
return ( | ||
<> | ||
<DisplayModal | ||
data-cy="inactive-versions-modal" | ||
open={modalOpen} | ||
setOpen={setModalOpen} | ||
title={`${versions?.length} Inactive ${pluralize("Version", versions?.length)}`} | ||
> | ||
{versions?.map((version) => ( | ||
<StyledVersionLabel | ||
key={version.id} | ||
trimMessage={false} | ||
{...version} | ||
/> | ||
))} | ||
</DisplayModal> | ||
<Button | ||
aria-label="Open inactive versions modal" | ||
data-cy="inactive-versions-button" | ||
onClick={() => { | ||
setModalOpen(true); | ||
}} | ||
size="xsmall" | ||
> | ||
<Icon fill={gray.base} glyph="List" /> | ||
<span>{versions?.length}</span> | ||
<InactiveVersionLine containerHeight={containerHeight ?? 0} /> | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
const InactiveVersionLine = styled.div<{ containerHeight: number }>` | ||
border-left: 2px dashed ${gray.base}; | ||
height: ${({ containerHeight }) => `${containerHeight}px`}; | ||
position: absolute; | ||
margin-left: 50%; | ||
top: 30px; | ||
z-index: 1; | ||
`; | ||
|
||
const StyledVersionLabel = styled(VersionLabel)` | ||
padding-top: ${size.xs}; | ||
`; |
11 changes: 11 additions & 0 deletions
11
apps/spruce/src/pages/waterfall/VersionLabel/InactiveBadge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import styled from "@emotion/styled"; | ||
import Badge, { Variant } from "@leafygreen-ui/badge"; | ||
import { size } from "constants/tokens"; | ||
|
||
export const InactiveBadge = () => ( | ||
<StyledBadge variant={Variant.LightGray}>Inactive</StyledBadge> | ||
); | ||
|
||
const StyledBadge = styled(Badge)` | ||
margin-left: ${size.xs}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
apps/spruce/src/pages/waterfall/VersionLabel/__snapshots__/VersionLabel_Default.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<div> | ||
<div | ||
class="css-1pp2qz6" | ||
> | ||
<div | ||
class="css-bnbttx-VersionContainer-columnBasis-wordBreakCss e3zirl01" | ||
> | ||
<p | ||
class="leafygreen-ui-1tb6tuo" | ||
> | ||
<a | ||
class="lg-ui-0000 leafygreen-ui-hvznge" | ||
href="/version/evergreen_ui_aec8832bace91f0f3b6d8ad3bb3b27fb4263be83/tasks" | ||
> | ||
<code | ||
class="leafygreen-ui-i6ovbf" | ||
> | ||
aec8832 | ||
</code> | ||
</a> | ||
|
||
09/19/2024, 10:56 | ||
</p> | ||
<p | ||
class="css-69ll71-CommitMessage e3zirl00 leafygreen-ui-1tb6tuo" | ||
title="DEVPROD-11387: Remove CSS grid layout, plus some additional description to demonstrate the overflow capabilities of the component (#397)" | ||
> | ||
<strong> | ||
Sophie Stadler | ||
</strong> | ||
• | ||
|
||
<a | ||
class="lg-ui-0001 css-1gw3cuq-StyledLink leafygreen-ui-16e7rxl" | ||
data-cy="jira-link" | ||
href="https://jira.mongodb.org/browse/DEVPROD-11387" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<span> | ||
DEVPROD-11387 | ||
</span> | ||
</a> | ||
: Remove CSS grid layout, plus some additional description to demonstrate the overflow capabilities of the component (#397) | ||
</p> | ||
</div> | ||
</div> | ||
</div> |
43 changes: 43 additions & 0 deletions
43
apps/spruce/src/pages/waterfall/VersionLabel/__snapshots__/VersionLabel_GitTag.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<div> | ||
<div | ||
class="css-1pp2qz6" | ||
> | ||
<div | ||
class="css-bnbttx-VersionContainer-columnBasis-wordBreakCss e3zirl01" | ||
> | ||
<p | ||
class="leafygreen-ui-1tb6tuo" | ||
> | ||
<a | ||
class="lg-ui-0000 leafygreen-ui-hvznge" | ||
href="/version/evergreen_ui_deb77a36604446272d610d267f1cd9f95e4fe8ff/tasks" | ||
> | ||
<code | ||
class="leafygreen-ui-i6ovbf" | ||
> | ||
deb77a3 | ||
</code> | ||
</a> | ||
|
||
09/19/2024, 12:14 | ||
</p> | ||
<p | ||
class="css-69ll71-CommitMessage e3zirl00 leafygreen-ui-1tb6tuo" | ||
title="parsley/v2.1.64" | ||
> | ||
<strong> | ||
Sophie Stadler | ||
</strong> | ||
• | ||
|
||
parsley/v2.1.64 | ||
</p> | ||
<p | ||
class="leafygreen-ui-1tb6tuo" | ||
> | ||
Git Tags: | ||
parsley/v2.1.64 | ||
</p> | ||
</div> | ||
</div> | ||
</div> |
53 changes: 53 additions & 0 deletions
53
apps/spruce/src/pages/waterfall/VersionLabel/__snapshots__/VersionLabel_Inactive.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<div> | ||
<div | ||
class="css-1pp2qz6" | ||
> | ||
<div | ||
class="css-8vthfw-VersionContainer-columnBasis-wordBreakCss e3zirl01" | ||
> | ||
<p | ||
class="leafygreen-ui-1tb6tuo" | ||
> | ||
<a | ||
class="lg-ui-0000 leafygreen-ui-hvznge" | ||
href="/version/evergreen_ui_aec8832bace91f0f3b6d8ad3bb3b27fb4263be83/tasks" | ||
> | ||
<code | ||
class="leafygreen-ui-i6ovbf" | ||
> | ||
aec8832 | ||
</code> | ||
</a> | ||
|
||
09/19/2024, 10:56 | ||
<div | ||
class="css-etc2w8-StyledBadge e96hp3z0 leafygreen-ui-c62i3c" | ||
> | ||
Inactive | ||
</div> | ||
</p> | ||
<p | ||
class="css-ql9iql-CommitMessage e3zirl00 leafygreen-ui-1tb6tuo" | ||
title="DEVPROD-11387: Remove CSS grid layout, plus some additional description to demonstrate the overflow capabilities of the component (#397)" | ||
> | ||
<strong> | ||
Sophie Stadler | ||
</strong> | ||
• | ||
|
||
<a | ||
class="lg-ui-0001 css-1gw3cuq-StyledLink leafygreen-ui-16e7rxl" | ||
data-cy="jira-link" | ||
href="https://jira.mongodb.org/browse/DEVPROD-11387" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<span> | ||
DEVPROD-11387 | ||
</span> | ||
</a> | ||
: Remove CSS grid layout, plus some additional description to demonstrate the overflow capabilities of the component (#397) | ||
</p> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.