-
-
Plugin Marketplace
+const Plugins = () => {
+ const allCategoriesSet = new Set(
+ [...plugins.corePlugins, ...plugins.otherPlugins].map(
+ ({ category }) => category,
+ ),
+ );
+ const allCategoriesArray = Array.from(allCategoriesSet).map(category => ({
+ name: category,
+ isSelected: false,
+ }));
+ const [categories, setCategories] =
+ useState
(allCategoriesArray);
+ const [selectedCategories, setSelectedCategories] = useState([]);
+ const [showCoreFeatures, setShowCoreFeatures] = useState(true);
+ const [showOtherPlugins, setShowOtherPlugins] = useState(true);
-
- Open source plugins that you can add to your Backstage deployment.
- Learn how to build a plugin.
-
+ const handleChipClick = (categoryName: string) => {
+ const isSelected =
+ categories.find(category => category.name === categoryName)?.isSelected ||
+ false;
+
+ const newSelectedCategories = isSelected
+ ? selectedCategories.filter(c => c !== categoryName)
+ : [...selectedCategories, categoryName];
+
+ setSelectedCategories(newSelectedCategories);
+
+ const newCategories = categories.map(category => {
+ if (category.name === categoryName) {
+ return { ...category, isSelected: !isSelected };
+ }
+ return category;
+ });
+
+ setCategories(newCategories);
+
+ if (!newSelectedCategories.includes('Core Feature')) {
+ setShowCoreFeatures(false);
+ } else {
+ setShowCoreFeatures(true);
+ }
+
+ if (
+ newSelectedCategories.length === 1 &&
+ newSelectedCategories[0] === 'Core Feature'
+ ) {
+ setShowOtherPlugins(false);
+ } else {
+ setShowOtherPlugins(true);
+ }
+
+ if (newSelectedCategories.length === 0) {
+ setShowOtherPlugins(true);
+ setShowCoreFeatures(true);
+ }
+ };
+
+ return (
+
+
+
+
+
Plugin Marketplace
+
+
+ Open source plugins that you can add to your Backstage deployment.
+ Learn how to build a plugin.
+
+
+
+
+ Add to Marketplace
+
-
- Add to Marketplace
-
+
+
+
+ {showCoreFeatures && (
+
+
Core Features
+
+ {plugins.corePlugins
+ .filter(
+ pluginData =>
+ !selectedCategories.length ||
+ selectedCategories.includes(pluginData.category),
+ )
+ .map(pluginData => (
+
+ ))}
+
+
+ )}
+
+ {showOtherPlugins && (
+
+
All Plugins
+
+ {plugins.otherPlugins
+ .filter(
+ pluginData =>
+ !selectedCategories.length ||
+ selectedCategories.includes(pluginData.category),
+ )
+ .map(pluginData => (
+
+ ))}
+
+
+ )}
-
-
-
- Core Features
-
-
- {plugins.corePlugins.map(pluginData => (
-
- ))}
-
-
- All Plugins
-
-
- {plugins.otherPlugins.map(pluginData => (
-
- ))}
-
-
-
-);
+
+ );
+};
export default Plugins;
diff --git a/microsite/src/pages/plugins/plugins.module.scss b/microsite/src/pages/plugins/plugins.module.scss
index bb08c2fd33..d5ea5de6e7 100644
--- a/microsite/src/pages/plugins/plugins.module.scss
+++ b/microsite/src/pages/plugins/plugins.module.scss
@@ -28,10 +28,60 @@
:global(.pluginsContainer) {
gap: 1rem;
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ grid-template-columns: repeat(auto-fit, minmax(250px, 300px));
+ }
+
+ @media (max-width: 768px) {
+ :global(.pluginsContainer) {
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ }
+ }
+
+ :global(.hidePluginsHeader) {
+ display: none;
}
:global(.fit-content) {
width: fit-content;
}
+
+ :global(.pluginsFilterBox) {
+ width: 100%;
+ margin-bottom: 1rem;
+ height: 1rem;
+ }
+
+ :global(.dropdown) {
+ float: right;
+ margin-bottom: 1rem;
+ }
+
+ :global(.button--info) {
+ background-color: transparent;
+ border-color: var(--ifm-color-primary);
+ color: var(--ifm-color-primary);
+ min-width: 250px;
+ }
+
+ :global(label.dropdown__item) {
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ margin-top: 5px;
+
+ &:hover {
+ background-color: var(--ifm-color-primary);
+ color: black;
+ }
+ }
+
+ :global(.dropdown__label) {
+ font-size: 15px;
+ cursor: pointer;
+ }
+
+ :global(.dropdown__checkbox) {
+ margin-right: 10px;
+ cursor: pointer;
+ }
}
diff --git a/microsite/src/util/types.ts b/microsite/src/util/types.ts
new file mode 100644
index 0000000000..fba7c0ba46
--- /dev/null
+++ b/microsite/src/util/types.ts
@@ -0,0 +1,4 @@
+export type ChipCategory = {
+ name: string;
+ isSelected: boolean;
+};