Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding react template #30

Merged
merged 1 commit into from Oct 16, 2019
Merged

Adding react template #30

merged 1 commit into from Oct 16, 2019

Conversation

kb-commit
Copy link
Contributor

This addresses couple of things:

  1. Being able to develop react app with go template variables is not very feasible.. so this allows you to have files with regular extensions and files with .tmpl extnesions.. for example you can have config.js for running your react app while development and config.js.tmpl as templating file.. when skeleton is generated it will skip config.js and use config.js.tmpl to generate config.js file instead
  2. Generates configurable frontend layout

@@ -0,0 +1,24 @@
package config

type reactApp struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these types are not exported to avoid namespace pollution

@@ -1,11 +1,17 @@
{
"name": "{{ .Name }}",
"name": "commit0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is only used for local dev, see corresponding template file that is used in code generation

<Layout>
<Router>
<Switch>
<Route path="/a">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are just placeholders as we add more meaningful content

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would be eventually be generating routes from API?

@@ -0,0 +1,15 @@
export default {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is only used for local dev, see corresponding template file that is used in code generation

@@ -0,0 +1,31 @@
const initialState = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a generic reducer that we will be able to use for common redux stores..

import { createMuiTheme } from '@material-ui/core/styles';

// A custom theme for this app
const theme = createMuiTheme({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was thinking to templatize these variables, but thought might be an overkill

func removeTmplDuplicates(keys []string) []string {
filteredKeys := []string{}
for _, key := range keys {
if !containsStr(keys, key+".tmpl") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

essentially if we have a .tmpl file with the same name, ignore the original file as its only used for local dev

Copy link
Contributor

@jb55 jb55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good so far, going to test this today

<Layout>
<Router>
<Switch>
<Route path="/a">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would be eventually be generating routes from API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants