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

Modify design of Tools and Showcase page #514

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8d421ea
Add search bar into tools page & Modify filtering design
fickevics-makor Jan 28, 2022
a6603ab
Modify "Featured" tool to display as a star instead of color
fickevics-makor Jan 28, 2022
0ffd21e
Modify tools showcase
fickevics-makor Feb 2, 2022
800c529
Remove old design
fickevics-makor Feb 2, 2022
e64d25b
Modify showcase design
fickevics-makor Feb 2, 2022
6f6e462
Merge branch 'cardano-foundation:staging' into new-tools-design
fill-the-fill Feb 2, 2022
8cf9c66
Fix react-popper yarn issue a
fickevics-makor Feb 2, 2022
eb72d45
Fix useLocation tags issue
fickevics-makor Feb 2, 2022
6c83416
Fix uselocation tags issue
fickevics-makor Feb 2, 2022
c878fb0
Set showcase toggle filter "AND" by default
fickevics-makor Feb 3, 2022
ec98282
Replace website button with Get started for needed projects in showca…
fickevics-makor Feb 3, 2022
5ae7394
Change "Featured" tags in in tools and showcases to "Favorite"
fickevics-makor Feb 3, 2022
82dc506
Add custom "Our Favorites" section on top of tools and showcases
fickevics-makor Feb 3, 2022
1b2d8d1
Add few useful comments into tools and showcase (Remove unnecessary c…
fickevics-makor Feb 3, 2022
f049b36
Add extra commit for local testing
fickevics-makor Feb 7, 2022
8d7b8db
Merge branch 'cardano-foundation:staging' into new-tools-design-preview
fill-the-fill Feb 7, 2022
d40b6ff
Remove "Preview" comment
fickevics-makor Feb 7, 2022
d7eee35
Modify search placeholder in tools and showcases
fickevics-makor Feb 7, 2022
18c06cd
Add project counters to tools and showcases
fickevics-makor Feb 7, 2022
687b1dc
Remove background colour on favourite tools and showcases
fickevics-makor Feb 7, 2022
de66299
Modify counter naming in tools and showcase
fickevics-makor Feb 7, 2022
decd730
Modify counter naming in tools and showcase with conditional function…
fickevics-makor Feb 7, 2022
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
"@docusaurus/preset-classic": "^2.0.0-beta.14",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.14",
"@mdx-js/react": "^1.6.22",
"@popperjs/core": "^2.11.2",
"clsx": "^1.1.1",
"node-fetch": "^2.6.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-popper": "^2.2.5",
"ts-node": "^10.4.0",
"typescript": "^4.5.3"
},
Expand Down
14 changes: 0 additions & 14 deletions src/components/showcase/ShowcaseCard/components/Button.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/showcase/ShowcaseCard/components/ShowcaseBody.js

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/showcase/ShowcaseCard/components/ShowcaseFooter.js

This file was deleted.

34 changes: 0 additions & 34 deletions src/components/showcase/ShowcaseCard/components/TagIcons.js

This file was deleted.

96 changes: 80 additions & 16 deletions src/components/showcase/ShowcaseCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,93 @@
* LICENSE file in the root directory of this source tree.
*/

import React, { memo } from "react";

import styles from "./styles.module.css";
import React, { memo, forwardRef } from "react";
import clsx from "clsx";
import Image from "@theme/IdealImage";
import ShowcaseFooter from './components/ShowcaseFooter'
import ShowcaseBody from "./components/ShowcaseBody";
import Link from "@docusaurus/Link";
import styles from "./styles.module.css";
import Tooltip from "../ShowcaseTooltip/index";
import { useLocation } from "@docusaurus/router";
import { Tags as ToolsTags } from "../../../data/builder-tools";
import { Tags as ShowcaseTags } from "../../../data/showcases";
import Fav from "../../../svg/fav.svg";

const TagComp = forwardRef(({ label, color, description }, ref) => (
<li className={styles.tag} title={description}>
<span className={styles.textLabel}>{label.toLowerCase()}</span>
<span className={styles.colorLabel} style={{ backgroundColor: color }} />
</li>
));

function ShowcaseCardTag({ tags }) {
const location = useLocation();
const selectedTags = location.pathname.includes("tools")
? ToolsTags
: ShowcaseTags;
const tagObjects = tags.map((tag) => ({ tag, ...selectedTags[tag] }));

const ShowcaseCard = memo(function ({ showcase }) {
const showFooter = showcase.getstarted || showcase.website || showcase.source
return (
<div key={showcase.title} className="col col--4 margin-bottom--lg">
<div className={clsx("card", styles.showcaseCard)}>
<div className={clsx("card__image", styles.showcaseCardImage)}>
<Image img={showcase.preview} alt={showcase.title} />
</div>
<ShowcaseBody {...showcase}/>
{showFooter && <ShowcaseFooter {...showcase}/>}
<>
{tagObjects.map((tagObject, index) => {
const id = `showcase_card_tag_${tagObject.tag}`;

return (
<Tooltip
key={index}
text={tagObject.description}
anchorEl="#__docusaurus"
id={id}
>
<TagComp key={index} {...tagObject} />
</Tooltip>
);
})}
</>
);
}

const ShowcaseCard = memo((card) => (
<li className="card shadow--md">
<div className={clsx("card__image", styles.showcaseCardImage)}>
<Image img={card.showcase.preview} alt={card.showcase.title} />
</div>
<div className="card__body">
<div className={clsx(styles.showcaseCardHeader)}>
<h4 className={styles.showcaseCardTitle}>
<Link href={card.showcase.website}>{card.showcase.title}</Link>
</h4>
{card.showcase.tags.includes("favorite") && (
<Fav svgClass={styles.svgIconFavorite} size="small" />
)}
{card.showcase.getstarted && (
<Link
href={card.showcase.getstarted}
className={clsx(
"button button--secondary button--sm",
styles.showcaseCardSrcBtn
)}
>
Get Started
</Link>
)}
{card.showcase.source && (
<Link
href={card.showcase.source}
className={clsx(
"button button--secondary button--sm",
styles.showcaseCardSrcBtn
)}
>
Source
</Link>
)}
</div>
<p className={styles.showcaseCardBody}>{card.showcase.description}</p>
</div>
);
});
<ul className={clsx("card__footer", styles.cardFooter)}>
<ShowcaseCardTag tags={card.showcase.tags} />
</ul>
</li>
));

export default ShowcaseCard;
92 changes: 76 additions & 16 deletions src/components/showcase/ShowcaseCard/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,91 @@
* LICENSE file in the root directory of this source tree.
*/

.showcaseCard {
height: 100%;
}

.showcaseCardImage {
max-height: 175px;
overflow: hidden;
height: 150px;
border-bottom: 2px solid var(--ifm-color-emphasis-200);
}

.showcaseCardHeader {
display: flex;
align-items: center;
margin-bottom: 12px;
}

.showcaseCardTitle {
margin-bottom: 0;
flex: 1 1 auto;
}

.showcaseCardTitle a {
text-decoration: none;
background: linear-gradient(
var(--ifm-color-primary),
var(--ifm-color-primary)
)
0% 100% / 0% 1px no-repeat;
transition: background-size ease-out 200ms;
}

.showcaseCardTitle a:not(:focus):hover {
background-size: 100% 1px;
}

.showcaseCardTitle,
.showcaseCardHeader .svgIconFavorite {
margin-right: 0.25rem;
}

.showcaseCardSrcBtn {
margin-left: 6px;
padding-left: 12px;
padding-right: 12px;
border: none !important;
}

.showcaseCardSrcBtn:focus-visible {
background-color: var(--ifm-color-secondary-dark);
}

html[data-theme='dark'] .showcaseCardSrcBtn {
background-color: var(--ifm-color-emphasis-200) !important;
color: inherit;
}

html[data-theme='dark'] .showcaseCardSrcBtn:hover {
background-color: var(--ifm-color-emphasis-300) !important;
}

.showcaseCardBody {
font-size: smaller;
line-height: 1.66;
}

.titleIconsRow {
.cardFooter {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
flex-wrap: wrap;
}

.titleIconsRowTitle {
flex: 1;
.tag {
font-size: 0.675rem;
border: 1px solid var(--ifm-color-secondary-darkest);
cursor: default;
margin-right: 6px;
margin-bottom: 6px !important;
border-radius: 12px;
display: inline-flex;
align-items: center;
}

.titleIconsRowIcons {
flex-grow: 0;
flex-shrink: 0;
.tag .textLabel {
margin-left: 8px;
}

.tagIcon {
margin: 0.2rem;
user-select: none;
.tag .colorLabel {
width: 7px;
height: 7px;
border-radius: 50%;
margin-left: 6px;
margin-right: 6px;
}
3 changes: 2 additions & 1 deletion src/components/showcase/ShowcaseCheckbox/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

.checkboxContainer {
.checkboxContainer {
display: inline;
padding: 5px;
user-select: none;
Expand All @@ -20,3 +20,4 @@
margin-left: 0.5rem;
text-overflow: ellipsis;
}

Loading