Skip to content

Commit ab4098b

Browse files
committed
Merge branch 'feature/redux'
2 parents 4ffc469 + 4d4b5f5 commit ab4098b

19 files changed

+544
-217
lines changed

CHANGE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- v0.2.0 Add `Add Redux Reducer` Action
2+
- v0.1.0 Add `Add React Component` Action

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# react-component-creator
2-
An Brainstorm Plugin to create a new react functional component with all additional files like
3-
SCSS, Spec, Storybook
2+
- An Brainstorm Plugin to create a new react functional component with all additional files like
3+
SCSS, Spec, Storybook.
4+
- Add Redux reducer module with actions, mutations, state and types
5+
46

57
![Create component](./doc/create-component.gif "")
68

resources/META-INF/plugin.xml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.faebeee.reactcomponentcreator</id>
33
<name>React Component Creator</name>
4-
<version>0.2.0</version>
4+
<version>0.3.0</version>
55
<vendor email="[email protected]" url="http://fabs.io">Fabio Gianini</vendor>
66

77
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
@@ -14,24 +14,46 @@
1414
<description>
1515
<![CDATA[
1616
<h1><a href="#react-component-creator" id="react-component-creator">react-component-creator</a></h1>
17-
<p>An Brainstorm Plugin to create a new react functional component with all additional files like
18-
SCSS, Spec, Storybook</p>
17+
<ul>
18+
<li>An Brainstorm Plugin to create a new react functional component with all additional files like
19+
SCSS, Spec, Storybook.</li>
20+
<li>Add Redux reducer module with actions, mutations, state and types</li>
21+
</ul>
1922
]]>
2023
</description>
2124

25+
<change-notes>
26+
<![CDATA[
27+
<ul>
28+
<li>v0.2.0 Add <code>Add Redux Reducer</code> Action</li>
29+
<li>v0.1.0 Add <code>Add React Component</code> Action</li>
30+
</ul>
31+
]]>
32+
</change-notes>
33+
2234

2335
<extensions defaultExtensionNs="com.intellij">
2436
<!-- Add your extensions here -->
2537
</extensions>
2638

2739
<actions>
28-
<!-- Add your actions here -->
29-
<action id="ReactComponent.ComponentCreatorAction"
30-
class="fabs.component.ComponentCreatorAction"
31-
icon="/icons/component.png"
32-
text="React Component"
33-
description="Create React component">
40+
<group description="React" id="React">
41+
<separator/>
42+
<action id="ReactComponent.ComponentCreatorAction"
43+
class="fabs.component.ComponentCreatorAction"
44+
icon="/icons/component.png"
45+
text="React component"
46+
description="create new react component">
47+
</action>
48+
49+
<action id="ReactComponent.ReducerCreatorAction"
50+
class="fabs.reducer.ReducerCreatorAction"
51+
icon="/icons/store.png"
52+
text="Redux reducer"
53+
description="create new redux reducer">
54+
</action>
55+
<separator/>
3456
<add-to-group group-id="NewGroup" anchor="first"/>
35-
</action>
57+
</group>
3658
</actions>
3759
</idea-plugin>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const {{ mutationType }} = '{{ moduleName }}/{{ mutationType }}';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Dispatch } from 'redux';
2+
import { {{ mutationType }} } from './action-types';
3+
import { {{ actionTypeName }} } from './types';
4+
5+
export const {{ actionFunctionName }} = () => async (dispatch: Dispatch<{{ actionTypeName }}>) => {
6+
dispatch({ type: {{ mutationType }} , data });
7+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { {{ moduleNamePascalCase }}Actions, {{ stateName }} } from './types';
2+
import { {{ mutationType }} } from './action-types';
3+
4+
export const initialState: {{ stateName }} = {
5+
};
6+
7+
export default function {{ moduleName }}Reducer(state = initialState, action: {{ moduleNamePascalCase }}Actions): {{ stateName }} {
8+
switch (action.type) {
9+
case {{ mutationType }}:
10+
return {
11+
...state,
12+
};
13+
default:
14+
return state;
15+
}
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Action } from 'redux';
2+
import { {{ mutationType }} } from './action-types';
3+
4+
export interface {{ stateName }} {
5+
}
6+
7+
export type {{ actionTypeName }} = Action<{{ mutationType }}> & {
8+
}
9+
10+
export type {{ moduleNamePascalCase }}Actions = {{ actionTypeName }};

src/fabs/component/ComponentCreator.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/fabs/component/ComponentCreatorAction.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
package fabs.component;
22

3-
import com.intellij.openapi.vfs.VirtualFile;
4-
import fabs.util.AbstractCreator;
53
import fabs.util.AbstractCreatorAction;
64
import fabs.util.AbstractDialog;
75

8-
import java.util.Map;
9-
106
public class ComponentCreatorAction extends AbstractCreatorAction {
11-
12-
@Override
13-
protected AbstractCreator createCreator(VirtualFile directory, String componentName, Map<String, Object> templateModel, String[] files) {
14-
return new ComponentCreator(directory, componentName, templateModel, files);
15-
}
16-
177
@Override
188
protected AbstractDialog createDialog() {
199
return new ComponentCreatorDialog();

0 commit comments

Comments
 (0)