Prettified Code!

This commit is contained in:
khatabwedaa
2020-08-23 08:53:05 +00:00
committed by GitHub Action
parent 259caa118d
commit 4f4e2d1a3e
2 changed files with 53 additions and 63 deletions

View File

@@ -1,84 +1,75 @@
export default [ export default [
{ {
name: 'Alerts', name: "Alerts",
components: [ components: [
{ name: 'SuccessPop' }, { name: "SuccessPop" },
{ name: 'InfoPop' }, { name: "InfoPop" },
{ name: 'WarningPop' }, { name: "WarningPop" },
{ name: 'ErrorPop' }, { name: "ErrorPop" },
{ name: 'NotificationPop' }, { name: "NotificationPop" },
{ name: 'SuccessFullWidth' }, { name: "SuccessFullWidth" },
{ name: 'InfoFullWidth' }, { name: "InfoFullWidth" },
{ name: 'WarningFullWidth' }, { name: "WarningFullWidth" },
{ name: 'ErrorFullWidth' }, { name: "ErrorFullWidth" },
], ],
}, },
{ {
name: 'Authentication', name: "Authentication",
components: [ components: [{ name: "SimpleLogin" }, { name: "LoginWithSideImage" }],
{ name: 'SimpleLogin' },
{ name: 'LoginWithSideImage' },
]
}, },
{ {
name: 'Cards', name: "Cards",
components: [ components: [
{ name: 'Article' }, { name: "Article" },
{ name: 'ArticleWithSMIcons' }, { name: "ArticleWithSMIcons" },
{ name: 'ArticleWithImage' }, { name: "ArticleWithImage" },
{ name: 'Product' }, { name: "Product" },
{ name: 'ProductWithEvaluation' }, { name: "ProductWithEvaluation" },
{ name: 'SimpleProduct' }, { name: "SimpleProduct" },
{ name: 'Testimonial' }, { name: "Testimonial" },
{ name: 'User' }, { name: "User" },
{ name: 'UserWithDetails' }, { name: "UserWithDetails" },
], ],
}, },
{ {
name: 'Forms', name: "Forms",
components: [{ name: "Simple" }, { name: "Newsletter" }],
},
{
name: "Navbars",
components: [ components: [
{ name: 'Simple' }, { name: "ECommerce" },
{ name: 'Newsletter' }, { name: "WithSearch" },
{ name: "WithAvatar" },
], ],
}, },
{ {
name: 'Navbars', name: "Heros",
components: [ components: [
{ name: 'ECommerce' }, { name: "ECommerce" },
{ name: 'WithSearch' }, { name: "WithImage" },
{ name: 'WithAvatar' }, { name: "WithPattern" },
]
},
{
name: 'Heros',
components: [
{ name: 'ECommerce' },
{ name: 'WithImage' },
{ name: 'WithPattern' },
], ],
}, },
{ {
name: 'Sections', name: "Sections",
components: [ components: [
{ name: 'AboutMe' }, { name: "AboutMe" },
{ name: 'Feature' }, { name: "Feature" },
{ name: 'OurTeam' }, { name: "OurTeam" },
{ name: 'ParagraphWithImage' }, { name: "ParagraphWithImage" },
] ],
}, },
{ {
name: 'Paginations', name: "Paginations",
components: [ components: [{ name: "Simple" }],
{ name: 'Simple' },
]
}, },
{ {
name: 'Footers', name: "Footers",
components: [ components: [
{ name: 'Simple' }, { name: "Simple" },
{ name: 'WithDetails' }, { name: "WithDetails" },
{ name: 'WithSubscribeForm' }, { name: "WithSubscribeForm" },
] ],
}, },
] ];

View File

@@ -1,7 +1,6 @@
import components from "./Components"; import components from "./Components";
export default class ComponentsFilter { export default class ComponentsFilter {
constructor() { constructor() {
this.components = components; this.components = components;
} }
@@ -11,16 +10,16 @@ export default class ComponentsFilter {
} }
whereCategory(category) { whereCategory(category) {
if (this.isEmpty(category)) return this.components;
if(this.isEmpty(category)) return this.components; let pattern = new RegExp(`^${category}`, "i");
let pattern = new RegExp(`^${category}`, 'i'); return this.components.filter((category) =>
category.name.match(pattern)
return this.components.filter(category => category.name.match(pattern)); );
} }
isEmpty(string) { isEmpty(string) {
return string.length === 0; return string.length === 0;
} }
} }