Skip to content

Commit bd278d5

Browse files
donghwi parkphated
andauthored
Add special styling for deprecated plugins in search (closes $113) (gulpjs#126)
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
1 parent d0c3bf3 commit bd278d5

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

src/pages/plugins/index.js

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function isInternalKeyword(keyword) {
1616
class Plugin {
1717
constructor(object) {
1818
this._package = object.package;
19+
this._flags = object.flags ? object.flags : {};
1920
}
2021

2122
get key() {
@@ -26,6 +27,16 @@ class Plugin {
2627
return this._package.name;
2728
}
2829

30+
get isDeprecated() {
31+
const isDeprecated = this._flags.deprecated ? true : false;
32+
return isDeprecated;
33+
}
34+
35+
get deprecatedMessage() {
36+
const deprecatedMessage = this._flags.deprecated ? this._flags.deprecated : '';
37+
return deprecatedMessage;
38+
}
39+
2940
get description() {
3041
return this._package.description;
3142
}
@@ -95,21 +106,30 @@ function PluginFooter({ keywords = [] }) {
95106
}
96107

97108
function PluginComponent({ plugin }) {
109+
const { isDeprecated, deprecatedMessage } = plugin
110+
const cardClasses = classnames('card', { [styles.pluginDeprecatedCard]: isDeprecated });
111+
const cardHeaderClasses = classnames('card__header', {
112+
[styles.pluginCardHeader]: !isDeprecated,
113+
[styles.deprecatedCardHeader]: isDeprecated
114+
});
115+
const cardBodyClasses = 'card__body';
116+
98117
return (
99118
<div className="row padding-vert--md">
100119
<div className="col col--10 col--offset-1">
101-
<div key={plugin.key} className="card">
102-
<div className={classnames('card__header', styles.pluginCardHeader)}>
120+
<div key={plugin.key} className={cardClasses}>
121+
<div className={cardHeaderClasses}>
122+
{isDeprecated && <span className="badge badge--primary">Deprecated</span>}
103123
<h2><a className={styles.primaryUrl} href={plugin.primaryUrl}>{plugin.name}</a></h2>
104-
<span className="badge badge--primary">{plugin.version}</span>
124+
{!isDeprecated && <span className="badge badge--primary">{plugin.version}</span>}
105125
</div>
106-
<div className="card__body">
107-
{plugin.description}
126+
<div className={cardBodyClasses}>
127+
{isDeprecated ? <div className={styles.deprecatedMessage}>{deprecatedMessage}</div> : plugin.description}
108128
<div className="padding-top--sm">
109129
{plugin.links.map((link) => <a key={link.text} className="padding-right--sm" href={link.href}>{link.text}</a>)}
110130
</div>
111131
</div>
112-
<PluginFooter keywords={plugin.keywords} />
132+
{!isDeprecated && <PluginFooter keywords={plugin.keywords} />}
113133
</div>
114134
</div>
115135
</div>
@@ -141,7 +161,6 @@ function keywordsToQuerystring(keywords) {
141161
} else {
142162
keywordsStr += `gulpplugin`;
143163
}
144-
145164
return keywordsStr;
146165
}
147166

@@ -150,6 +169,8 @@ async function fetchPackages(keywords, searchText = '', pageNumber = 0) {
150169

151170
let search = [
152171
keywordsToQuerystring(keywords),
172+
"is:unstable",
173+
"not:unstable"
153174
];
154175
if (searchText) {
155176
search.push(encodeURIComponent(searchText));

src/pages/plugins/plugins.module.scss

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
.searchInput {
66
flex-grow: 1;
7-
87
appearance: none;
98
background-color: var(--ifm-navbar-search-input-background-color);
109
background-image: var(--ifm-navbar-search-input-icon);
@@ -31,6 +30,30 @@
3130
font-size: 1.1rem;
3231
}
3332

33+
.pluginDeprecatedCard {
34+
background-color: #ffdfdf;
35+
}
36+
37+
.deprecatedCardHeader {
38+
display: flex;
39+
justify-content: flex-start;
40+
align-items: center;
41+
42+
h2 {
43+
margin-left: var(--ifm-card-horizontal-spacing);
44+
}
45+
}
46+
47+
48+
.deprecatedMessage {
49+
color: var(--ifm-color-primary-dark);
50+
background-color: var(--ifm-color-white);
51+
padding: 0.5rem;
52+
border-radius: var(--ifm-card-border-radius);
53+
border-style: solid;
54+
border-width: 1px;
55+
}
56+
3457
.pluginCardHeader {
3558
display: flex;
3659
justify-content: space-between;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy