Skip to content

Commit

Permalink
Merge c547a1e into 89281f8
Browse files Browse the repository at this point in the history
  • Loading branch information
VNadygin committed May 10, 2018
2 parents 89281f8 + c547a1e commit d29bc60
Show file tree
Hide file tree
Showing 35 changed files with 12,604 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict';

import styled from 'styled-components';

export const RouteHeaderStyled = styled.div`
position: relative;
z-index: 2;
z-index: 9;
`;

RouteHeaderStyled.displayName = 'RouteHeaderStyled';
6 changes: 6 additions & 0 deletions demo/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,9 @@ export { TagRoute }
from './routes/tag/tag';
export { TagDemoRoute }
from './routes/tag/demo';
export { AccordionIndexRoute }
from './routes/accordion';
export { AccordionRoute }
from './routes/accordion/accordion';
export { AccordionDemoRoute }
from './routes/accordion/demo';
26 changes: 26 additions & 0 deletions demo/routes/accordion/accordion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

import React from 'react';
import {
RouteStructure,
} from '../../components/Route/RouteStructure';

export const AccordionRoute = props => (
<RouteStructure
componentTitle="Accordion"
tabs={[
{
text: 'General Info',
href: '/accordion',
},
{
text: 'Use Cases',
href: '/accordion/demo',
},
]}
>
{ props.children }
</RouteStructure>
);

AccordionRoute.displayName = 'AccordionRoute';
108 changes: 108 additions & 0 deletions demo/routes/accordion/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from 'react';
import { Accordion } from 'reactackle';
import { RouteDemo } from '../../components/Route/RouteStructure';

import {
TestBox,
DemoSnippet,
DemoPreview,
DemoCode,
} from '../../components/DemoSnippet/DemoSnippet';

import SnippetDefault from './snippets/1.snippet';
import SnippetExpanded from './snippets/2.snippet';
import SnippetSingle from './snippets/3.snippet';
import SnippetHeaderComponent from './snippets/4.snippet';
import SnippetStateless from './snippets/5.snippet';
import SnippetExpandAll from './snippets/6.snippet';

const SAMPLE_ITEMS = [
{
id: '1',
title: 'Accordion Item 1',
content: [<div key={0}>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div key={0}>Place here some data</div>],
},
];

const SAMPLE_ITEMS_CUSTOM_HEADING = [
{
id: '1',
title: 'Accordion Item 1',
content: [<div key={0}>Place here some data</div>],
headerSlot: [<em key={0}>Some header component</em>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div key={0}>Place here some data</div>],
headerSlot: [<em key={0}>Some header component</em>],
},
];


export const AccordionDemoRoute = () => (
<RouteDemo>
<DemoSnippet title="Default accordion">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion items={SAMPLE_ITEMS} />
</TestBox>
</DemoPreview>
<DemoCode code={SnippetDefault} />
</DemoSnippet>
<DemoSnippet title="Accordion with all items expanded by default">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion items={SAMPLE_ITEMS} expandAll />
</TestBox>
</DemoPreview>
<DemoCode code={SnippetExpandAll} />
</DemoSnippet>
<DemoSnippet title="Only single item can be opened">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion items={SAMPLE_ITEMS} single />
</TestBox>
</DemoPreview>
<DemoCode code={SnippetSingle} />
</DemoSnippet>
<DemoSnippet title="Accordion with expanded items">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion
items={SAMPLE_ITEMS}
expandedItemIds={['2']}
/>
</TestBox>
</DemoPreview>
<DemoCode code={SnippetExpanded} />
</DemoSnippet>
<DemoSnippet title="Accordion Item with HeaderSlot">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion items={SAMPLE_ITEMS_CUSTOM_HEADING} />
</TestBox>
</DemoPreview>
<DemoCode code={SnippetHeaderComponent} />
</DemoSnippet>
<DemoSnippet title="Accordion with expanded items and stateless">
<DemoPreview>
<TestBox maxWidth="500px">
<Accordion
items={SAMPLE_ITEMS}
expandedItemIds={['2']}
stateless
/>
</TestBox>
</DemoPreview>
<DemoCode code={SnippetStateless} />
</DemoSnippet>
</RouteDemo>
);

AccordionDemoRoute.displayName = 'AccordionDemoRoute';
41 changes: 41 additions & 0 deletions demo/routes/accordion/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { RouteInfo, RouteProps } from '../../components/Route/RouteStructure';

//eslint-disable-next-line
import AccordionCode from '!raw-loader!../../../packages/reactackle-accordion/src/Accordion';
//eslint-disable-next-line
import AccordionItemCode from '!raw-loader!../../../packages/reactackle-accordion/src/AccordionItem/AccordionItem';

const propTypes = RouteInfo.propTypes;
const defaultProps = {
...RouteInfo.defaultProps,
componentTitle: 'Accordion',
routeTitle: 'Accordion',
mobile: true,
desktop: true,
};

const itemProps = [
<RouteProps
key='accordion'
componentCode={AccordionCode}
/>,
<RouteProps
key="accordion-item"
title='Accordion Item props'
componentCode={AccordionItemCode}
/>,
];

export const AccordionIndexRoute = props => (
<div className="route-info">
<RouteInfo {...props} >
{itemProps}
</RouteInfo>
</div>
);


AccordionIndexRoute.propTypes = propTypes;
AccordionIndexRoute.defaultProps = defaultProps;
AccordionIndexRoute.displayName = 'AccordionIndexRoute';
14 changes: 14 additions & 0 deletions demo/routes/accordion/snippets/1.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Accordion
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
}
]}
/>
15 changes: 15 additions & 0 deletions demo/routes/accordion/snippets/2.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Accordion
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
}
]}
expandedItemIds={['2']}
/>
15 changes: 15 additions & 0 deletions demo/routes/accordion/snippets/3.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Accordion
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
}
]}
single={true}
/>
17 changes: 17 additions & 0 deletions demo/routes/accordion/snippets/4.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Accordion
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
headerSlot: [<em>Some header component</em>]
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
headerSlot: [<em>Some header component</em>]
}
]}
single={true}
/>
16 changes: 16 additions & 0 deletions demo/routes/accordion/snippets/5.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Accordion
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
}
]}
stateless
expandedItemIds={['2']}
/>
15 changes: 15 additions & 0 deletions demo/routes/accordion/snippets/6.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Accordion
expandAll
items = {[
{
id: '1',
title: 'Accordion Item 1',
content: [<div>Place here some data</div>],
},
{
id: '2',
title: 'Accordion Item 2',
content: [<div>Place here some data</div>],
}
]}
/>
9 changes: 9 additions & 0 deletions packages/reactackle-accordion/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**The MIT License (MIT)**

Copyright (c) 2017 Braincrumbs.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 changes: 17 additions & 0 deletions packages/reactackle-accordion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Reactackle-accordion


**Part of [Reactackle](https://www.npmjs.com/package/reactackle) - an open-source components library built with [React](https://facebook.github.io/react/) and [Styled Components](https://www.styled-components.com).**

## Installation

**Using NPM:**
```
npm install reactackle-accordion --save
```

**Using Yarn:**
```
yarn add reactackle-accordion
```
[Component Demo](http://reactackle-docs.braincrumbs.io/#/accordion/demo)
5 changes: 5 additions & 0 deletions packages/reactackle-accordion/__tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"jest": true
}
}

0 comments on commit d29bc60

Please sign in to comment.