Skip to content

Commit

Permalink
Added sidebar for molecule
Browse files Browse the repository at this point in the history
  • Loading branch information
pallavikadam-srijan committed Oct 21, 2021
1 parent 4d91278 commit ce50d42
Show file tree
Hide file tree
Showing 8 changed files with 405 additions and 7 deletions.
14 changes: 7 additions & 7 deletions stories/Molecules/Blocks/ImageRevelCard/ImageCard.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getCaptionForLocale = (locale) => {
}
};

<Meta title="Molecules/Blocks/Image Revel Card" />
<Meta title="Molecules/Blocks/Image Reveal Card" />

<style>{`
.subheading {
Expand All @@ -32,11 +32,11 @@ export const getCaptionForLocale = (locale) => {
}
`}</style>

# Image Revel Card Component
The Image revel card component multi usage component which creates boxes that are usually teasing some kind of content like - Image, Text, and CTA Link. We are using the grid system here <code>assets/scss/grid.scss</code>. Atoms tags are used for creating this card.
# Image Reveal Card Component
The Image reveal card component multi usage component which creates boxes that are usually teasing some kind of content like - Image, Text, and CTA Link. We are using the grid system here <code>assets/scss/grid.scss</code>. Atoms tags are used for creating this card.

<div className="subheading">Image Revel Card- Medium</div>
<p>Image Revel Card of medium size are shows the Image, and CTA Link. The text will show on hover.</p>
<div className="subheading">Image Reveal Card- Medium</div>
<p>Image Reveal Card of medium size are shows the Image, and CTA Link. The text will show on hover.</p>

<Story name="Image card">
{(args, { globals: { locale } }) => {
Expand All @@ -45,8 +45,8 @@ The Image revel card component multi usage component which creates boxes that ar
}}
</Story>

<div className="subheading">Image Revel Card- Small</div>
<p>Image Revel Card of small size comes with a different image, and CTA Link. The text will show on hover.</p>
<div className="subheading">Image Reveal Card- Small</div>
<p>Image Reveal Card of small size comes with a different image, and CTA Link. The text will show on hover.</p>

<Story name="Image card-small">
{(args, { globals: { locale } }) => {
Expand Down
18 changes: 18 additions & 0 deletions stories/Molecules/Sidebar-data/Sidebardata.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { useEffect } from 'react';
import './sidebardata.scss';

export const Sidebardata = ({ data, headerText }) => {

return (
<>
<a href="#" className="accordion__heading">{headerText}</a>
<ul class="accordion__panel">
{data.map(function (item, index) {
return (
<li className="accordion__panel--description"><a href="#" key={index}> {item.descriptionText} </a></li>
)
})}
</ul>
</>
);
};
46 changes: 46 additions & 0 deletions stories/Molecules/Sidebar-data/sidebardata.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@import '../../assets/scss/mixins';
@import '../../assets/scss/breakpoints';
@import '../../assets/scss/variables';

.accordion__heading {
border: none;
font-family: $Font-Family-ProximaBold;
font-size: $font-size-16;
margin-bottom: 0;
padding: $spacing-24;

@include devicebreak(medium) {
display: block;
}
}

.accordion__panel {
padding: 0;

&--description > a {
border: none;
display: block;
font-family: $Font-Family-ProximaRegular;
font-size: $font-size-14;
margin: $spacing-16 $spacing-24 0 $spacing-32;

@include devicebreak(medium) {
font-size: $font-size-16;
margin-bottom: $spacing-16;
margin-left: $spacing-48;
}
}
}

[dir='rtl'] {
.accordion__panel {
&--description > a {
margin-left: $spacing-24;
margin-right: $spacing-32;

@include devicebreak(medium) {
margin-right: $spacing-48;
}
}
}
}
36 changes: 36 additions & 0 deletions stories/Organism/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { useEffect } from 'react';
import { FaqFun, SidebarMenu } from '../../assets/js/Faq_custom'
import { Sidebardata } from '../../Molecules/Sidebar-data/Sidebardata';
import './sidebar.scss';

export const Sidebar = ({ headerText, label, data }) => {
useEffect(() => {
FaqFun();
SidebarMenu();
}, [])

return (
<div className='grid-x grid-margin-x'>
<div className='cell medium-4 accordion-wrapper'>
<div className='accordion-navbar__menu' id='sidebar-menu'><span>{label}</span></div>
<ul className='accordion-navbar' id="accordion">
<li className='accordion-navbar__item'>
<Sidebardata data={data} headerText={headerText} />
</li>
<li className='accordion-navbar__no-children'>
<a href="#" className="accordion__heading">{headerText}</a>
</li>
<li className='accordion-navbar__item'>
<Sidebardata data={data} headerText={headerText} />
</li>
<li className='accordion-navbar__no-children'>
<a href="#" className="accordion__heading">{headerText}</a>
</li>
<li className='accordion-navbar__no-children'>
<a href="#" className="accordion__heading">{headerText}</a>
</li>
</ul>
</div>
</div>
);
};
171 changes: 171 additions & 0 deletions stories/Organism/Sidebar/Sidebar.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import { Meta, Story } from "@storybook/addon-docs";
import { Sidebar } from "./Sidebar";

export const getCaptionForLocale = (locale) => {
switch (locale) {
case "english":
const engText = {
sidebardata: [
{
descriptionText: "Subpage title",
},
{
descriptionText:
"Subpage with an exceptionally long title on two lines",
},
{
descriptionText: "Subpage title",
},
],
headerText: "PAGE TITLE",
label: "MENU",
};
return engText;
case "arabic":
const arabicText = {
sidebardata: [
{
descriptionText: "عنوان الصفحة الفرعية",
},
{
descriptionText: "صفحة فرعية بعنوان طويل بشكل استثنائي في سطرين",
},
{
descriptionText: "عنوان الصفحة الفرعية",
},
],
headerText: "عنوان الصفحة",
label: "قائمة",
};
return arabicText;
case "burmese":
const burmeseText = {
sidebardata: [
{
descriptionText: "စာမျက်နှာခွဲခေါင်းစဉ်",
},
{
descriptionText:
"စာကြောင်းနှစ်ကြောင်းတွင်ထူးခြားသောခေါင်းစဉ်ရှည်ပါ ၀ င်သောစာမျက်နှာခွဲ",
},
{
descriptionText: "စာမျက်နှာခွဲခေါင်းစဉ်",
},
],
headerText: "စာမျက်နှာခေါင်းစဉ်",
label: "မီနူး",
};
return burmeseText;
case "japanese":
const japaneseText = {
sidebardata: [
{
descriptionText: "サブページのタイトル",
},
{
descriptionText: "2行に非常に長いタイトルのサブページ",
},
{
descriptionText: "サブページのタイトル",
},
],
headerText: "ページタイトル",
label: "メニュー",
};
return japaneseText;
default:
const dummy = {
sidebardata: [
{
descriptionText: "Subpage title",
},
{
descriptionText:
"Subpage with an exceptionally long title on two lines",
},
{
descriptionText: "Subpage title",
},
],
headerText: "PAGE TITLE",
label: "Menu",
};
return dummy;
}
};

<Meta title="Organism/Navigation/Sidebar" />

<style>{`
.subheading {
font-weight: 700;
font-size: 24px;
color: #031c2d;
letter-spacing: 1.5px;
line-height: 24px;
margin-bottom: 12px;
margin-top: 40px;
}
.sbdocs .sbdocs-p,
.sbdocs .sbdocs-li{
font-size: 1rem;
}
.css-1gh4yjl {
font-size: 1rem;
}
`}</style>

# Sidebar Component

The Sidebar Component is a shorter piece of text that appears next to and accompanies a longer article.

<Story name="Sidebar">
{(args, { globals: { locale } }) => {
const caption = getCaptionForLocale(locale);
return (
<Sidebar
data={caption.sidebardata}
headerText={caption.headerText}
label={caption.label}
active={"default"}
></Sidebar>
);
}}
</Story>

<div className="subheading">Dependency</div>
Libraries or another dependency which are used in the component.
<ul>
<li>
For toggle functionality its depend on the jQuery plugin library, that is
placed in preview-head.html file.
</li>
<li>
Custom JS file (Faq_custom.js) is located in the same component folder.
</li>
<li>
ID - (#accordion) is used in the JSX file to connect the Custom JS file to
achieve the functionality.
</li>
</ul>

<div className="subheading">Usage</div>
<ul>
<li>Take HTML from the HTML tab in the canvas</li>
<u>To use SCSS include the following files in your implementation</u>
<li>
Include the common SCSS files like variables, mixin from{" "}
<code>assets/scss</code>
</li>
<li>
Component SCSS file: <code>sidebar.scss</code>
</li>
<u>To use CSS include the following files in your implementation</u>
<li>
The compiled CSS file from <code>assets/css/style.css</code>
</li>
<u>To use JS include the following files in your implementation</u>
<li>
The compiled JS file from <code>assets/js/Faq_custom.js</code>
</li>
</ul>
Loading

0 comments on commit ce50d42

Please sign in to comment.