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 #506

Closed
Closed
Show file tree
Hide file tree
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
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.

95 changes: 79 additions & 16 deletions src/components/showcase/ShowcaseCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,92 @@
* 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("featured") && (
<Fav svgClass={styles.svgIconFavorite} size="small" />
)}
{card.showcase.website && (
<Link
href={card.showcase.website}
className={clsx(
"button button--secondary button--sm",
styles.showcaseCardSrcBtn
)}
>
Website
</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;
96 changes: 80 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,95 @@
* 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;
}

.showcaseCardHeader .svgIconFavorite {
color: var(--site-color-svg-icon-favorite);
}

.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