Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldhanekaa committed Apr 23, 2021
1 parent ed719ed commit bb94c59
Show file tree
Hide file tree
Showing 36 changed files with 10,954 additions and 1,912 deletions.
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: "\U0001F41B Bug report"
about: 'Bugs, missing documentation, or unexpected behavior '
title: ''
labels: ''
assignees: ''
---

<!--
* Please fill out this template with all the relevant information so we can
understand what's going on and fix the issue. We appreciate bugs filed and PRs
submitted!
* Please make sure that you are familiar with and follow the Code of Conduct for
this project (found in the CODE_OF_CONDUCT.md file).
-->

`windmill-dashboard-react` version: ``

### Relevant code or config:

```html
<!-- your code here -->
```

### What you did:

<!-- What you were doing -->

### What happened:

<!-- Please provide the full error message/screenshots/anything -->

### Reproduction:

<!--
If possible, please create a repository that reproduces the issue with the
minimal amount of code possible
Or if you can, try to reproduce the issue in a Codesandbox or CodePen
-->

### Problem description:

<!-- Please describe why the current behavior is a problem -->

### Suggested solution:

<!--
It's ok if you don't have a suggested solution, but it really helps if you could
do a little digging to come up with some suggestion of how to improve things.
-->
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "\U0001F4A1 Feature request"
about: 'I have a suggestion (and might want to implement myself)! '
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Binary file added .github/windmill-dashboard-react.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 182 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,198 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
<p align="center">
<a href="https://windmillui.com/dashboard-react">
<img alt="Windmill Dashboard React" width="600" src=".github/windmill-dashboard-react.png">
</a><br>
Four 100 scores and PWA ready. Just connect your data.
</p>

## Getting Started
🚀 [See it live](https://windmillui.com/dashboard-react)

First, run the development server:
This is not a template. This is a complete application, built on top of React, with all tiny details taken care of so you just need to bring the data to feed it.

```bash
npm run dev
# or
yarn dev
Accessibility is a priority in my projects and I think it should be in yours too, so this was developed listening to real screen readers, focus traps and keyboard navigation are available everywhere.

## 📦 Features

- 🦮 Throughly accessible (developed using screen readers)
- 🌗 Dark theme enabled (load even different images based on theme)
- 🧩 Multiple (custom) components
- ⚡ Code splitting
- Tailwind CSS
- [Windmill React UI](https://windmillui.com/react-ui)
- React Router
- Heroicons
- Chart.js
- PWA delivering offline-first and app-like experience

## 📚 Docs

### General components

Windmill Dashboard React is built on top of [Windmill React UI](https://windmillui.com/react-ui). You will find the documentation for every small component there.

### Routing

Routes in Windmill Dashboard are separated into two categories, sidebar ([routes/sidebar.js](src/routes/sidebar.js)) and general ([routes/index.js](src/routes/index.js)).

#### Sidebar routes

These are the routes that will show in the sidebar. They expect three properties:

- `path`: the destination;
- `name`: the name to be shown;
- `icon`: an icon to illustrate the item

Item that are used as dropdowns, like the Pages option, don't need a `path`, but expect a `routes` array of objects with `path` and `name`:

```js
// sidebar.js
{
path: '/app/tables',
icon: 'TablesIcon',
name: 'Tables',
},
{
icon: 'PagesIcon', // <-- this is used as a submenu, so no path
name: 'Pages',
routes: [
// submenu
{
path: '/login',
name: 'Login', // <-- these don't have icons
},
{
path: '/create-account',
name: 'Create account',
},
```
#### General (Router) routes
These are **internal** (private) routes. They will be rendered inside the app, using the default `containers/Layout`.
If you want to add a route to, let's say, a landing page, you should add it to the `App`'s router ([src/App.js](src/App.js), exactly like `Login`, `CreateAccount` and other pages are routed.
#### How to add a new page to router?
1. Create your page inside `src/pages`, say `MyPage.js`;
2. Add it to the global router (`src/routes/index.js`)
```js
const MyPage = lazy(() => import('../pages/MyPage'));
```
Then add it to the `routes` array:
```js
{
path: '/my-page', // the url that will be added to /app/
component: MyPage, // the page component you jsut imported
}
```
3. If you want to make this page accessible from the sidebar, you have to options:
- add it to the root `routes` array
```js
{
path: '/app/my-page', // /app + the url you added in routes/index.js
icon: 'HomeIcon', // the component being exported from src/icons/index.js
name: 'My Page', // name that appear in Sidebar
},
```
- add it as an option under a dropdown
```js
{
icon: 'PagesIcon',
name: 'Pages',
routes: [
// submenu
{
path: '/app/my-page',
name: 'My Page',
},
```
If you're asking where does this `/app` come from, it is from this line inside `src/App.js`, that renders the app:
```jsx
<Route path='/app' component={Layout} />
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
---
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
To learn more about Next.js, take a look at the following resources:
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
### `npm run build` fails to minify
## Deploy on Vercel
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
---
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
windmill dashboard for nextjs, created by Aldhanekaa
23 changes: 23 additions & 0 deletions components/CTA.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

function CTA() {
return (
<a
className='flex items-center justify-between p-4 mb-8 text-sm font-semibold text-purple-100 bg-purple-600 rounded-lg shadow-md focus:outline-none focus:shadow-outline-purple'
href='https://github.com/estevanmaito/windmill-dashboard-react'
>
<div className='flex items-center'>
<svg className='w-5 h-5 mr-2' fill='currentColor' viewBox='0 0 20 20'>
<path d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z'></path>
</svg>
<span>Star this project on GitHub</span>
</div>
<span>
View more{' '}
<span dangerouslySetInnerHTML={{ __html: '&RightArrow;' }}></span>
</span>
</a>
);
}

export default CTA;
18 changes: 18 additions & 0 deletions components/Cards/InfoCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { Card, CardBody } from '@windmill/react-ui'

function InfoCard({ title, value, children: icon }) {
return (
<Card>
<CardBody className="flex items-center">
{icon}
<div>
<p className="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p>
<p className="text-lg font-semibold text-gray-700 dark:text-gray-200">{value}</p>
</div>
</CardBody>
</Card>
)
}

export default InfoCard
12 changes: 12 additions & 0 deletions components/Chart/ChartCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'

function Chart({ children, title }) {
return (
<div className="min-w-0 p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
<p className="mb-4 font-semibold text-gray-800 dark:text-gray-300">{title}</p>
{children}
</div>
)
}

export default Chart
16 changes: 16 additions & 0 deletions components/Chart/ChartLegend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'

function ChartLegend({ legends }) {
return (
<div className="flex justify-center mt-4 space-x-3 text-sm text-gray-600 dark:text-gray-400">
{legends.map((legend) => (
<div className="flex items-center" key={legend.title}>
<span className={`inline-block w-3 h-3 mr-1 ${legend.color} rounded-full`}></span>
<span>{legend.title}</span>
</div>
))}
</div>
)
}

export default ChartLegend
Loading

0 comments on commit bb94c59

Please sign in to comment.