Skip to content

Commit

Permalink
fix(cli): let init produce app using css-modules instead of styled-jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Jun 10, 2020
1 parent 81badb9 commit f43fd65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
9 changes: 9 additions & 0 deletions cli/config/init.App.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 1rem;
}
14 changes: 2 additions & 12 deletions cli/config/init.entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import { DataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import classes from './App.module.css'

const query = {
me: {
Expand All @@ -9,18 +10,7 @@ const query = {
}

const MyApp = () => (
<div className="container">
<style jsx>{`
.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 1rem;
}
}`}</style>
<div className={classes.container}>
<DataQuery query={query}>
{({ error, loading, data }) => {
if (error) return <span>ERROR</span>
Expand Down
4 changes: 4 additions & 0 deletions cli/src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ const handler = async ({ force, name, cwd, lib }) => {
path.join(__dirname, '../../config/init.App.test.js'),
path.join(paths.base, 'src/App.test.js')
)
fs.copyFileSync(
path.join(__dirname, '../../config/init.App.module.css'),
path.join(paths.base, 'src/App.module.css')
)
}
}

Expand Down

0 comments on commit f43fd65

Please sign in to comment.