Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Card list for service instances (#732)
* Refactor Card list for service instances * Rename PreformattedCard for InfoCard. Other minor css changes
- Loading branch information
1 parent
82a54d7
commit a29ec5c
Showing
18 changed files
with
476 additions
and
188 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.deleted { | ||
background-color: #c5c5c5; | ||
} | ||
|
||
.failed { | ||
background-color: #cb1515; | ||
} | ||
|
||
.deployed { | ||
background-color: #15cb2d; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,7 @@ | ||
.ChartListItem { | ||
color: #1c2b39; | ||
} | ||
|
||
.ChartListItem__content__title { | ||
margin: 0; | ||
width: 100%; | ||
font-weight: bold; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
color: #1c2b39; | ||
} | ||
|
||
.ChartListItem__content__info { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.ChartListItem__content__info_repo { | ||
display: inline-block; | ||
color: #fff; | ||
border-radius: 16px; | ||
background-color: #1c2b39; | ||
} | ||
|
||
.ChartListItem__content__info_other { | ||
display: inline-block; | ||
color: rgb(0, 0, 0); | ||
margin-left: 0.3em; | ||
border-radius: 16px; | ||
background-color: #1598cb; | ||
} | ||
|
||
.DELETED { | ||
background-color: #c5c5c5; | ||
} | ||
|
||
.FAILED { | ||
background-color: #cb1515; | ||
} | ||
|
||
.DEPLOYED { | ||
background-color: #15cb2d; | ||
} | ||
|
||
.ChartListItem__content__info_repo.stable { | ||
.ListItem__content__info_tag.stable { | ||
background-color: #1598cb; | ||
} | ||
|
||
.ChartListItem__content__info_repo.incubator { | ||
.ListItem__content__info_tag.incubator { | ||
background-color: #f58220; | ||
} |
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
43 changes: 6 additions & 37 deletions
43
dashboard/src/components/ChartList/__snapshots__/ChartListItem.test.tsx.snap
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 |
---|---|---|
@@ -1,42 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`should render an item 1`] = ` | ||
<Card | ||
className="ChartListItem" | ||
<InfoCard | ||
icon="/api/chartsvc/icon.png" | ||
info="1.0.0" | ||
key="[object Object]/foo" | ||
responsive={true} | ||
> | ||
<Link | ||
replace={false} | ||
title="foo" | ||
to="/charts/foo" | ||
> | ||
<CardIcon | ||
icon="/api/chartsvc/icon.png" | ||
/> | ||
<CardContent> | ||
<div | ||
className="ChartListItem__content" | ||
> | ||
<h3 | ||
className="ChartListItem__content__title type-big" | ||
> | ||
foo | ||
</h3> | ||
<div | ||
className="ChartListItem__content__info" | ||
> | ||
<p | ||
className="ChartListItem__content__info_version margin-reset type-small padding-t-tiny type-color-light-blue" | ||
> | ||
1.0.0 | ||
</p> | ||
<span | ||
className="ChartListItem__content__info_repo undefined type-small padding-t-tiny padding-h-normal" | ||
/> | ||
</div> | ||
</div> | ||
</CardContent> | ||
</Link> | ||
</Card> | ||
link="/charts/foo" | ||
title="foo" | ||
/> | ||
`; |
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,34 @@ | ||
.ListItem { | ||
color: #1c2b39; | ||
} | ||
|
||
.ListItem__content__title { | ||
margin: 0; | ||
width: 100%; | ||
font-weight: bold; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
color: #1c2b39; | ||
} | ||
|
||
.ListItem__content__info { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.ListItem__content__info_tag { | ||
float: right; | ||
margin-left: 3px; | ||
margin-bottom: 3px; | ||
color: #fff; | ||
border-radius: 16px; | ||
} | ||
|
||
.ListItem__content__info_tag-1 { | ||
background-color: #1c2b39; | ||
} | ||
|
||
.ListItem__content__info_tag-2 { | ||
background-color: #1598cb; | ||
} |
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 @@ | ||
import { shallow } from "enzyme"; | ||
import * as React from "react"; | ||
|
||
import { Link } from "react-router-dom"; | ||
import InfoCard from "./InfoCard"; | ||
|
||
it("should render a Card", () => { | ||
const wrapper = shallow( | ||
<InfoCard | ||
title="foo" | ||
info="foobar" | ||
link="/a/link/somewhere" | ||
icon="an-icon.png" | ||
tag1Class="blue" | ||
tag1Content="database" | ||
tag2Class="red" | ||
tag2Content="running" | ||
/>, | ||
); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it("should generate a dummy link if it's not provided", () => { | ||
const wrapper = shallow( | ||
<InfoCard | ||
title="foo" | ||
info="foobar" | ||
icon="an-icon.png" | ||
tag1Class="blue" | ||
tag1Content="database" | ||
tag2Class="red" | ||
tag2Content="running" | ||
/>, | ||
); | ||
expect(wrapper.find(Link).props()).toMatchObject({ to: "#" }); | ||
}); | ||
|
||
it("should avoid tags if they are not defined", () => { | ||
const wrapper = shallow( | ||
<InfoCard title="foo" info="foobar" link="/a/link/somewhere" icon="an-icon.png" />, | ||
); | ||
expect(wrapper.find(".ListItem__content__info_tag")).not.toExist(); | ||
}); |
Oops, something went wrong.