-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
12,604 additions
and
4 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
demo/components/Route/RouteHeading/styles/RouteHeaderStyled.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>], | ||
} | ||
]} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>], | ||
} | ||
]} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"env": { | ||
"jest": true | ||
} | ||
} |
Oops, something went wrong.