Skip to content

Commit 3836e3f

Browse files
authored
Merge pull request #159 from oslabs-beta/master
Final
2 parents 4895a59 + c17a650 commit 3836e3f

File tree

127 files changed

+3722
-595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3722
-595
lines changed

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
<p align="center">
2-
<img width="50" src="https://github.com/team-reactype/ReacType/blob/master/app/src/public/icons/png/256x256.png?raw=true">
2+
<img width="50" src=https://i.imgur.com/Z2aKWji.png?1>
33
<h1 align="center">ReacType </h1>
44
</p>
55

66
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
77
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
8-
![Release: 3.0](https://img.shields.io/badge/Release-3.0-orange)
8+
![Release: 4.0](https://img.shields.io/badge/Release-4.0-orange)
99

1010
**ReacType** is a visual prototyping tool for developers employing **React** component architecture alongside the comprehensive type checking of **TypeScript**.
1111
In other words, **you can draw prototypes and export React / Typescript code!**
1212

1313
**ReacType** allows the user to _visualize_ their application architecture dynamically, employing a _drag-and-drop canvas display_ and a _real-time component code preview_. The user can create components and drag _instances_ of these components, as well as HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
1414

15-
**New with version 3.0:**
15+
**New with version 4.0:**
1616

17-
- Export code as a [Next.js](https://nextjs.org/) project
18-
- Create nestable components/HTML elements using a drag-and-drop canvas
19-
- Add CSS to any element on the canvas
20-
- Components and HTML canvas elements are rendered in the canvas in the same way they'll be rendered in the exported project
21-
- View dynamically generated Next.js or classic React code as you build your project
22-
- Authenticate with Github or email
23-
- Save data for multiple projects in the cloud
24-
- Critical Electron security gaps resolved
17+
- View dynamically created components/HTML elements in the component tree
18+
- View Typescript syntax for React
19+
- Code preview is fully editable (make changes before exporting project)
20+
- Create custom HTML elements
21+
- Improved UI experience
22+
- Implemented a comprehensive tutorial page with images
2523

2624
Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windows](https://github.com/team-reactype/ReacType/releases/), [Linux](https://github.com/team-reactype/ReacType/releases/).
2725

2826
- **Mac users**: After opening the dmg and dragging ReacType into your Applications folder, ctrl+click the icon and select 'Open' from the context menu to run the app. This extra step is necessary since we don't have an Apple developer license yet.
2927

28+
- **Windows users**: Install the application by running ReacType Setup 4.0.0.exe.
29+
3030
- **Linux users**: Run the application as a super user in order to read and write files.
3131

32-
![Gif of adding](https://i.imgur.com/nOeuuU6.gif)
32+
![Gif of adding](https://i.imgur.com/Ioqkr00.gif)
3333

3434
### How to use
3535

36-
- **Log in:** Sign up through email/Github if you would like to save your projects to the cloud. Otherwise, select _Continue as Guest_
37-
- **Select project type:** By default, new projects will be Next.js projects, but you can toggle your project to be a normal React application by selecting "Classic React" in the bottom-right corner.
38-
- **Next.js** projects allow you to easily create routing between pages within ReacType and render content with static rendering.
39-
- **Classic React** projects are vanilla React. You can create multiple "root" components, but routing between these root components is enabled by default.
40-
- **Add components:** Add a new component in the left panel. If the _Page_ checkbox is selected, the component will become a page that can be routed to. For example, a page component named 'Home', the component's corresponding route will be '/Home'. [Learn more about Next.js routing](https://nextjs.org/docs/routing/introduction).
41-
- **Create instances of components/HTML elements:** Each component has its own canvas where you can see how any instances of nested components or HTML elements will render in production. To create an instance of a component or traditional HTML element in the canvas, simply drag it onto the canvas. The following elements have special properties when they're dragged onto the canvas:
42-
- **Page/root components:** Page/root components cannot be dragged into other components.
43-
- **Divs:** Divs are arbitrarily nestable.
44-
- **Navigation components:** Next.js projects have "Navigation components" which allow you to create links between your page components.
45-
- **Update CSS and delete instances:** Click on the component canvas or an instance to view/edit CSS attributes in the right panel. Updates made to the CSS will render in the canvas on _Save_.
46-
- **Save your project:** Select _Save Project_ to save a new project to the cloud. Once you've created a new project in the cloud, it will be autoamtically saved on each change. You can open any of your other saved projects by selecting _Open Project_.
47-
- **Export your project:** Select _Export Project_ to save your project locally. You will have the option of exporting either a fully functional application or only exporting the component files.
36+
- **Sign-in page**: Sign up for an account, authenticate via Github/Facebook, or just continue as a guest.
37+
- **Tutorial**: Click ‘Tutorial’ from the help tab’s drop-down menu of the help tab at the top left of the application to view a tutorial page.
38+
- **Start a project (only after authenticating)**: After you authenticate via Github/Facebook, create a new project, and select whether you want your project to be a Next.js or a classic React project. Also, save your project so that you can return to it at a later time.
39+
- **Add Components**: Create components on the left panel. Components can be associated with a route, or they can be used within other components.
40+
- **Delete Components**: Delete components after focusing on them from the right panel. Be careful when deleting components because all instances of the component will be deleted within the application/project.
41+
- **Add Custom Elements**: Create custom elements or add HTML elements that you are more familiar with into the application. Once the project is exported, the HTML tags generated in the code preview will function the way the label is supposed to work. You can create functionality for custom elements in a new file. The tutorial on HTML Elements explains more on how to do this.
42+
- **Delete Elements**: Delete elements by clicking on the ‘X’ button next to the element. Be careful when deleting elements because all element elements will be deleted within the application/project.
43+
- **Create instances on the canvas**: Each component has its canvas. Create an example of an element or HTML element by dragging it onto the canvas. Div components are arbitrarily nestable and useful for complex layouts. Next.js projects have Link components to enable client-side navigation to other routes.
44+
- **Component Tree**: Click on the component tree tab next to the code preview tab to view the component tree hierarchy.
45+
- **Update styling**: Click on an element on the canvas to update basic styling using the right functions. As you create new instances and add styling, watch as your code dynamically generates in the bottom panel.
46+
- **User preference features**: Select a theme for the code preview to your liking and change the application’s lighting.
47+
- **Export project**: Click the “Export Project’ button to export the project’s application files into a Typescript file. The exported project is fully functional with Webpack, Express server, routing, etc., and will match what’s mocked on the canvas.
4848

4949
#### Contributors
5050

@@ -54,18 +54,24 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
5454

5555
[Andrew Cho](https://www.linkedin.com/in/andrewjcho84/) [@andrewjcho84](https://github.com/andrewjcho84)
5656

57+
[Brian Han](https://www.linkedin.com/in/brianjisoohan/) [@brianjshan](https://github.com/brianjshan)
58+
5759
[Charles Finocchiaro](https://www.linkedin.com/in/charles-finocchiaro-62440040/) [@null267](https://github.com/null267)
5860

5961
[Chelsey Fewer](https://www.linkedin.com/in/chelsey-fewer/) [@chelseyeslehc](https://github.com/chelseyeslehc)
6062

6163
[Christian Padilla](https://linkedin.com/in/ChristianEdwardPadilla) [@ChristianEdwardPadilla](https://github.com/ChristianEdwardPadilla)
6264

65+
[Diego Vazquez](https://www.linkedin.com/in/diegovazquezny/) [@diegovazquezny](https://github.com/diegovazquezny)
66+
6367
[Eliot Nguyen](https://linkedin.com/in/ibeeliot) [@ibeeliot](https://github.com/ibeeliot)
6468

6569
[Fredo Chen](https://www.linkedin.com/in/fredochen/) [@fredosauce](https://github.com/fredosauce)
6670

6771
[Jesse Zuniga](https://linkedin.com/in/jesse-zuniga) [@jzuniga206](https://github.com/jzuniga206)
6872

73+
[Jin Soo Lim](https://www.linkedin.com/in/jin-soo-lim-3a567b1b3/) [@jinsoolim](https://github.com/jinsoolim)
74+
6975
[Mitchel Severe](https://www.linkedin.com/in/misevere/) [@mitchelsevere](https://github.com/mitchelsevere)
7076

7177
[Natalie Vick](https://www.linkedin.com/in/vicknatalie/) [@natattackvick](https://github.com/natattackvick)
@@ -78,6 +84,8 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
7884

7985
[Sophia Huttner](https://www.linkedin.com/in/sophia-huttner-68315975/) [@sophjean](https://github.com/sophjean)
8086

87+
[Stormi Hashimoto](https://www.linkedin.com/in/stormikph/) [@stormikph](https://github.com/stormikph)
88+
8189
[Tolga Mizrakci](https://linkedin.com/in/tolga-mizrakci) [@tolgamizrakci](https://github.com/tolgamizrakci)
8290

8391
[Tony Ito-Cole](https://linkedin.com/in/tony-ito-cole) [@tonyito](https://github.com/tonyito)
@@ -109,20 +117,26 @@ npm run dev
109117
- Please note that the development build is not connected to the production server. `npm run dev` should spin up the development server from the server folder of this repo. For additional information, the readme is [here](https://github.com/open-source-labs/ReacType/blob/master/server/README.md). Alternatively, you can also select "Continue as guest" on the log-in page of the app to not use any features that rely on the server (authentication and saving project data.)
110118

111119
## To Run Your Exported Next.js Project
120+
112121
- Open exported project directory
113122
- Install dependencies
114123

115124
```bash
116125
npm install
117126
```
127+
118128
- Build the app
129+
119130
```bash
120131
npm run build
121132
```
133+
122134
- Start an instance
135+
123136
```bash
124137
npm run start
125138
```
139+
126140
- Open browser and navigate to localhost at specified port
127141

128142
## License

__tests__/BottomTabs.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React, { useReducer} from 'react';
2+
import '@testing-library/jest-dom';
3+
import { render, fireEvent, cleanup, screen } from '@testing-library/react';
4+
5+
import BottomTabs from '../app/src/components/bottom/BottomTabs';
6+
import StateContext from '../app/src/context/context';
7+
import initialState from '../app/src/context/initialState';
8+
import reducer from '../app/src/reducers/componentReducer';
9+
10+
function Test() {
11+
const [state, dispatch] = useReducer(reducer, initialState);
12+
return (
13+
<StateContext.Provider value={[state, dispatch]} >
14+
<BottomTabs />
15+
</StateContext.Provider>
16+
)
17+
}
18+
19+
test('Bottom Panel Contains Two Tabs: Code Preview and Component Tree', () => {
20+
render(<Test/>);
21+
expect(screen.getAllByRole('tab')).toHaveLength(2);
22+
expect(screen.getByText('Code Preview')).toBeInTheDocument();
23+
expect(screen.getByText('Component Tree')).toBeInTheDocument();
24+
})

__tests__/HTMLPanel.test.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React, { useReducer} from 'react';
2+
import '@testing-library/jest-dom';
3+
import { DndProvider } from 'react-dnd';
4+
import { HTML5Backend } from 'react-dnd-html5-backend';
5+
import { render, fireEvent, cleanup, screen } from '@testing-library/react';
6+
7+
import StateContext from '../app/src/context/context';
8+
import initialState from '../app/src/context/initialState';
9+
import reducer from '../app/src/reducers/componentReducer';
10+
import HTMLPanel from '../app/src/components/left/HTMLPanel';
11+
12+
13+
function Test() {
14+
const [state, dispatch] = useReducer(reducer, initialState);
15+
return (
16+
<DndProvider backend={HTML5Backend}>
17+
<StateContext.Provider value={[state, dispatch]} >
18+
<HTMLPanel />
19+
</StateContext.Provider>
20+
</DndProvider>
21+
)
22+
}
23+
24+
25+
test('Renders HTMLPanel component', () => {
26+
render(
27+
<Test/>
28+
);
29+
expect(screen.getAllByRole('textbox')).toHaveLength(2);
30+
expect(screen.getByText('Div')).toBeInTheDocument();
31+
expect(screen.getByText('Image')).toBeInTheDocument();
32+
expect(screen.getByText('Form')).toBeInTheDocument();
33+
expect(screen.getByText('List')).toBeInTheDocument();
34+
expect(screen.getByText('Button')).toBeInTheDocument();
35+
expect(screen.getByText('Link')).toBeInTheDocument();
36+
expect(screen.getByText('Paragraph')).toBeInTheDocument();
37+
expect(screen.getByText('Header 1')).toBeInTheDocument();
38+
expect(screen.getByText('Header 2')).toBeInTheDocument();
39+
expect(screen.getByText('Span')).toBeInTheDocument();
40+
})
41+
42+
test('Adds new custom element', () => {
43+
render(
44+
<Test/>
45+
);
46+
47+
fireEvent.change(screen.getAllByRole('textbox')[0], {
48+
target: { value: 'Testing' }
49+
});
50+
fireEvent.change(screen.getAllByRole('textbox')[1], {
51+
target: { value: 'Testing' }
52+
});
53+
54+
fireEvent.click(screen.getByDisplayValue('Add Element'));
55+
56+
expect(screen.getByText('Testing')).toBeInTheDocument();
57+
})
58+

0 commit comments

Comments
 (0)