Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit c1d4f91

Browse files
authored
Merge pull request #2 from csvenke/feature/map-component
Renames ArrayMap => Map, bump 0.2.0
2 parents bdde1e0 + eff8923 commit c1d4f91

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-semantics",
3-
"version": "0.1.1",
4-
"description": "Useful semantic helper components for working with React.",
3+
"version": "0.2.0",
4+
"description": "Semantic helper components for working with React.",
55
"author": "Christian Svenkerud",
66
"repository": {
77
"type": "git",

src/components/ArrayMap/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/ArrayMap/ArrayMap.test.tsx renamed to src/components/Map/Map.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { shallow } from 'enzyme';
22
import * as React from 'react';
33

4-
import ArrayMap from './ArrayMap';
4+
import Map from './Map';
55

66
describe('with render', () => {
77
const input = [1, 2, 3];
88
const output = '<div>1</div><div>2</div><div>3</div>';
99

1010
test('should return primary content from render', () => {
11-
const element = <ArrayMap array={input} render={n => <div key={n}>{n}</div>} />;
11+
const element = <Map array={input} render={n => <div key={n}>{n}</div>} />;
1212
const wrapper = shallow(element);
1313
expect(wrapper.html()).toEqual(output);
1414
});
@@ -19,7 +19,7 @@ describe('with children', () => {
1919
const output = '<div>1</div><div>2</div><div>3</div>';
2020

2121
test('should return primary content from children', () => {
22-
const element = <ArrayMap array={input}>{n => <div key={n}>{n}</div>}</ArrayMap>;
22+
const element = <Map array={input}>{n => <div key={n}>{n}</div>}</Map>;
2323
const wrapper = shallow(element);
2424
expect(wrapper.html()).toEqual(output);
2525
});
@@ -32,9 +32,9 @@ describe('with children and render', () => {
3232

3333
test('should return primary content from children and ignore render', () => {
3434
const element = (
35-
<ArrayMap array={input} render={n => <a key={n}>{n}</a>}>
35+
<Map array={input} render={n => <a key={n}>{n}</a>}>
3636
{n => <div key={n}>{n}</div>}
37-
</ArrayMap>
37+
</Map>
3838
);
3939
const wrapper = shallow(element);
4040
expect(wrapper.html()).toEqual(outputChildren);
@@ -46,7 +46,7 @@ describe('without children and render', () => {
4646
const input = [1, 2, 3];
4747

4848
test('should return null', () => {
49-
const element = <ArrayMap array={input} />;
49+
const element = <Map array={input} />;
5050
const wrapper = shallow(element);
5151
expect(wrapper.html()).toEqual(null);
5252
});

src/components/ArrayMap/ArrayMap.tsx renamed to src/components/Map/Map.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as PropTypes from 'prop-types';
22
import * as React from 'react';
33

4-
export interface IArrayMapProps {
4+
export interface IMapProps {
55
/** Array to map. */
66
array: any[];
77

@@ -17,16 +17,16 @@ export interface IArrayMapProps {
1717
*
1818
* @example
1919
*
20-
* <ArrayMap
20+
* <Map
2121
* array={[1, 2, 3]}
2222
* render={n => <div>{n}</div>}
2323
* />
2424
*
25-
* <ArrayMap array={[1, 2, 3]}>
25+
* <Map array={[1, 2, 3]}>
2626
* {n => <div>{n}</div>}
2727
* </ArrayMap>
2828
*/
29-
const ArrayMap: React.SFC<IArrayMapProps> = ({ array, render, children }) => {
29+
const Map: React.SFC<IMapProps> = ({ array, render, children }) => {
3030
const func = children ? children : render;
3131

3232
if (!func) {
@@ -36,10 +36,10 @@ const ArrayMap: React.SFC<IArrayMapProps> = ({ array, render, children }) => {
3636
return <React.Fragment>{array.map((a, b, c) => func(a, b, c))}</React.Fragment>;
3737
};
3838

39-
ArrayMap.propTypes = {
39+
Map.propTypes = {
4040
array: PropTypes.arrayOf(PropTypes.any).isRequired,
4141
children: PropTypes.func,
4242
render: PropTypes.func,
4343
};
4444

45-
export default ArrayMap;
45+
export default Map;

src/components/Map/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './Map';

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default as ArrayMap } from './components/ArrayMap';
1+
export { default as Map } from './components/Map';
22
export { default as Show } from './components/Show';

0 commit comments

Comments
 (0)