Skip to content

Commit 7c7a1ee

Browse files
committed
Merge pull request #100 from TechnologyAdvice/feature/list-examples
Feature/list examples
2 parents b250670 + 6d599fe commit 7c7a1ee

31 files changed

+621
-13
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, {Component} from 'react';
2+
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample';
3+
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection';
4+
5+
export default class ListContentExamples extends Component {
6+
render() {
7+
return (
8+
<ExampleSection title='Content'>
9+
<ComponentExample
10+
title='Item'
11+
description='A list item can contain a set of items'
12+
examplePath='elements/List/Content/ListItemExample'
13+
/>
14+
<ComponentExample
15+
title='Icon'
16+
description='A list item can contain an icon'
17+
examplePath='elements/List/Content/ListIconExample'
18+
/>
19+
<ComponentExample
20+
title='Image'
21+
description='A list can contain an image'
22+
examplePath='elements/List/Content/ListImageExample'
23+
/>
24+
<ComponentExample
25+
title='Link'
26+
description='A list can contain links'
27+
examplePath='elements/List/Content/ListLinkExample'
28+
/>
29+
<ComponentExample
30+
title='Header'
31+
description='A list can contain a header'
32+
examplePath='elements/List/Content/ListHeaderExample'
33+
/>
34+
<ComponentExample
35+
title='Description'
36+
description='A list can contain a description'
37+
examplePath='elements/List/Content/ListDescriptionExample'
38+
/>
39+
</ExampleSection>
40+
);
41+
}
42+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListDescriptionExample extends Component {
5+
render() {
6+
const mapIcon = <i className='map marker icon' />;
7+
8+
return (
9+
<List>
10+
<ListItem icon={mapIcon} header='Chicago' description='This city is located in the state of Illinois' />
11+
<ListItem icon={mapIcon} header='Nashville' description='This city is located in the state of Tennessee' />
12+
</List>
13+
);
14+
}
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListHeaderExample extends Component {
5+
render() {
6+
return (
7+
<List>
8+
<ListItem header='Chapter 1' description='The chapter in which we meet the characters' />
9+
<ListItem header='Chapter 2' description='The chapter in which the bad guy is introduced' />
10+
<ListItem header='Chapter 3' description='Spoiler alert: The chapter in which the good guy wins!'/>
11+
</List>
12+
);
13+
}
14+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListIconExample extends Component {
5+
render() {
6+
const helpIcon = <i className='help icon' />;
7+
const triangleIcon = <i className='right triangle icon' />;
8+
9+
return (
10+
<List>
11+
<ListItem
12+
icon={helpIcon}
13+
header='Floated Icon'
14+
description='This text will always have a left margin so it sits alongside the icon'
15+
/>
16+
<ListItem
17+
icon={triangleIcon}
18+
header='Icon Alignment'
19+
description='Floated icons are by default top aligned'
20+
/>
21+
<ListItem icon={helpIcon}>
22+
This item uses <code>child</code> text, check the code.
23+
</ListItem>
24+
</List>
25+
);
26+
}
27+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import faker from 'faker';
2+
import React, {Component} from 'react';
3+
import {List, ListItem, Image} from 'stardust';
4+
5+
export default class ListImageExample extends Component {
6+
render() {
7+
const helenAvatar = <Image className='avatar' src={faker.image.internet.avatar()} />;
8+
const christianAvatar = <Image className='avatar' src={faker.image.internet.avatar()} />;
9+
const danielAvatar = <Image className='avatar' src={faker.image.internet.avatar()} />;
10+
return (
11+
<List>
12+
<ListItem image={helenAvatar} header='Helen' />
13+
<ListItem image={christianAvatar} header='Christian' />
14+
<ListItem image={danielAvatar} header='Daniel' />
15+
</List>
16+
);
17+
}
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListItemExample extends Component {
5+
render() {
6+
return (
7+
<List>
8+
<ListItem description='1' />
9+
<ListItem description='2' />
10+
<ListItem description='3' />
11+
</List>
12+
);
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListLinkExample extends Component {
5+
render() {
6+
const link1 = <a>What is a FAQ?</a>;
7+
const link2 = <a>Who is our user base?</a>;
8+
const link3 = <a>Where is our office located?</a>;
9+
return (
10+
<List>
11+
<ListItem description={link1} />
12+
<ListItem description={link2} />
13+
<ListItem description={link3} />
14+
</List>
15+
);
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React, {Component} from 'react';
2+
import ListTypesExamples from './Types/ListTypesExamples';
3+
import ListContentExamples from './Content/ListContentExamples';
4+
import ListVariationsExamples from './Variations/ListVariationsExamples';
5+
6+
export default class ListExamples extends Component {
7+
render() {
8+
return (
9+
<div>
10+
<ListTypesExamples />
11+
<ListContentExamples />
12+
<ListVariationsExamples />
13+
</div>
14+
);
15+
}
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListBulletedExample extends Component {
5+
render() {
6+
return (
7+
<List className='bulleted'>
8+
<ListItem description='Apples' />
9+
<ListItem description='Pears' />
10+
<ListItem description='Oranges' />
11+
</List>
12+
);
13+
}
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, {Component} from 'react';
2+
import {List, ListItem} from 'stardust';
3+
4+
export default class ListLinkExample extends Component {
5+
render() {
6+
const link1 = <a>Home</a>;
7+
const link2 = <a>About</a>;
8+
const link3 = <a>Services</a>;
9+
const link4 = <a>Careers</a>;
10+
return (
11+
<List className='link'>
12+
<ListItem className='active' description={link1} />
13+
<ListItem description={link2} />
14+
<ListItem description={link3} />
15+
<ListItem description={link4} />
16+
</List>
17+
);
18+
}
19+
}

0 commit comments

Comments
 (0)