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 [
{
name: 'Alerts',
name: "Alerts",
components: [
{ name: 'SuccessPop' },
{ name: 'InfoPop' },
{ name: 'WarningPop' },
{ name: 'ErrorPop' },
{ name: 'NotificationPop' },
{ name: 'SuccessFullWidth' },
{ name: 'InfoFullWidth' },
{ name: 'WarningFullWidth' },
{ name: 'ErrorFullWidth' },
{ name: "SuccessPop" },
{ name: "InfoPop" },
{ name: "WarningPop" },
{ name: "ErrorPop" },
{ name: "NotificationPop" },
{ name: "SuccessFullWidth" },
{ name: "InfoFullWidth" },
{ name: "WarningFullWidth" },
{ name: "ErrorFullWidth" },
],
},
{
name: 'Authentication',
components: [
{ name: 'SimpleLogin' },
{ name: 'LoginWithSideImage' },
]
name: "Authentication",
components: [{ name: "SimpleLogin" }, { name: "LoginWithSideImage" }],
},
{
name: 'Cards',
name: "Cards",
components: [
{ name: 'Article' },
{ name: 'ArticleWithSMIcons' },
{ name: 'ArticleWithImage' },
{ name: 'Product' },
{ name: 'ProductWithEvaluation' },
{ name: 'SimpleProduct' },
{ name: 'Testimonial' },
{ name: 'User' },
{ name: 'UserWithDetails' },
{ name: "Article" },
{ name: "ArticleWithSMIcons" },
{ name: "ArticleWithImage" },
{ name: "Product" },
{ name: "ProductWithEvaluation" },
{ name: "SimpleProduct" },
{ name: "Testimonial" },
{ name: "User" },
{ name: "UserWithDetails" },
],
},
{
name: 'Forms',
name: "Forms",
components: [{ name: "Simple" }, { name: "Newsletter" }],
},
{
name: "Navbars",
components: [
{ name: 'Simple' },
{ name: 'Newsletter' },
{ name: "ECommerce" },
{ name: "WithSearch" },
{ name: "WithAvatar" },
],
},
{
name: 'Navbars',
name: "Heros",
components: [
{ name: 'ECommerce' },
{ name: 'WithSearch' },
{ name: 'WithAvatar' },
]
},
{
name: 'Heros',
components: [
{ name: 'ECommerce' },
{ name: 'WithImage' },
{ name: 'WithPattern' },
{ name: "ECommerce" },
{ name: "WithImage" },
{ name: "WithPattern" },
],
},
{
name: 'Sections',
name: "Sections",
components: [
{ name: 'AboutMe' },
{ name: 'Feature' },
{ name: 'OurTeam' },
{ name: 'ParagraphWithImage' },
]
{ name: "AboutMe" },
{ name: "Feature" },
{ name: "OurTeam" },
{ name: "ParagraphWithImage" },
],
},
{
name: 'Paginations',
components: [
{ name: 'Simple' },
]
name: "Paginations",
components: [{ name: "Simple" }],
},
{
name: 'Footers',
name: "Footers",
components: [
{ name: 'Simple' },
{ name: 'WithDetails' },
{ name: 'WithSubscribeForm' },
]
{ name: "Simple" },
{ name: "WithDetails" },
{ name: "WithSubscribeForm" },
],
},
]
];

View File

@@ -1,7 +1,6 @@
import components from "./Components";
export default class ComponentsFilter {
constructor() {
this.components = components;
}
@@ -11,16 +10,16 @@ export default class ComponentsFilter {
}
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) {
return string.length === 0;
}
}