added basic theming
This commit is contained in:
parent
3afe91679a
commit
b4249df653
31
app/client/package-lock.json
generated
31
app/client/package-lock.json
generated
|
|
@ -14273,17 +14273,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react": {
|
|
||||||
"version": "16.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-0.0.0-4a1072194.tgz",
|
|
||||||
"integrity": "sha512-ZUj2lkUDLjwJaGu4WD0dYSvsfIyhQt2l/AJDlg4ij+rCDU3fSFKgHWanNovViUoaWHAxgrpft3KGFfvWPZH5LA==",
|
|
||||||
"requires": {
|
|
||||||
"loose-envify": "^1.1.0",
|
|
||||||
"object-assign": "^4.1.1",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"scheduler": "^0.12.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-app-polyfill": {
|
"react-app-polyfill": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-0.2.0.tgz",
|
||||||
|
|
@ -14467,17 +14456,6 @@
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-dom": {
|
|
||||||
"version": "16.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-0.0.0-4a1072194.tgz",
|
|
||||||
"integrity": "sha512-GfG8Vh/jMcnJKDpv7T6O1pS/WVqiocjPQ9o9cscW8bjR9W36DT3Xb4pDZT70t1xyVvX48/NrTQGz0H7I3fCLhQ==",
|
|
||||||
"requires": {
|
|
||||||
"loose-envify": "^1.1.0",
|
|
||||||
"object-assign": "^4.1.1",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"scheduler": "^0.12.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-error-overlay": {
|
"react-error-overlay": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-5.1.2.tgz",
|
||||||
|
|
@ -15780,15 +15758,6 @@
|
||||||
"xmlchars": "^1.3.1"
|
"xmlchars": "^1.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scheduler": {
|
|
||||||
"version": "0.12.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.0.0-4a1072194.tgz",
|
|
||||||
"integrity": "sha512-U+PqKfBcR39RFbJrlJPFwDXG2iLOZBGOPzNSWTAGUoOfTiL8qHTkemJeyV5CcL0UyaRgR8g3S469cNWFs/SHIw==",
|
|
||||||
"requires": {
|
|
||||||
"loose-envify": "^1.1.0",
|
|
||||||
"object-assign": "^4.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schema-utils": {
|
"schema-utils": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ContainerWidget from "../widgets/ContainerWidget"
|
import ContainerWidget from "../widgets/ContainerWidget"
|
||||||
|
|
||||||
export type ActionType = "LOAD_CANVAS" | "CLEAR_CANVAS" | "DROP_WIDGET_CANVAS" | "REMOVE_WIDGET_CANVAS"
|
export type ActionType = "LOAD_CANVAS" | "CLEAR_CANVAS" | "DROP_WIDGET_CANVAS" | "REMOVE_WIDGET_CANVAS"
|
||||||
export const ActionTypes = {
|
export const ActionTypes: { [id: string]: ActionType } = {
|
||||||
LOAD_CANVAS: "LOAD_CANVAS",
|
LOAD_CANVAS: "LOAD_CANVAS",
|
||||||
CLEAR_CANVAS: "CLEAR_CANVAS",
|
CLEAR_CANVAS: "CLEAR_CANVAS",
|
||||||
DROP_WIDGET_CANVAS: "DROP_WIDGET_CANVAS",
|
DROP_WIDGET_CANVAS: "DROP_WIDGET_CANVAS",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export const a = () => {
|
|
||||||
|
|
||||||
}
|
|
||||||
45
app/client/src/constants/DefaultTheme.tsx
Normal file
45
app/client/src/constants/DefaultTheme.tsx
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
import * as styledComponents from "styled-components"
|
||||||
|
import { Color, FontFamily, Colors, Fonts } from "./StyleConstants"
|
||||||
|
|
||||||
|
const {
|
||||||
|
default: styled,
|
||||||
|
css,
|
||||||
|
keyframes,
|
||||||
|
createGlobalStyle,
|
||||||
|
ThemeProvider
|
||||||
|
} = styledComponents as styledComponents.ThemedStyledComponentsModule<
|
||||||
|
IThemeInterface
|
||||||
|
>
|
||||||
|
|
||||||
|
export interface IFontInterface {
|
||||||
|
fontSize: number
|
||||||
|
fontColor: Color,
|
||||||
|
fontFamily: FontFamily
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IThemeInterface {
|
||||||
|
primaryColor: Color
|
||||||
|
secondaryColor: Color
|
||||||
|
ascentColor: Color
|
||||||
|
headerFont: IFontInterface,
|
||||||
|
titleFont: IFontInterface,
|
||||||
|
subTitleFont: IFontInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultFont: IFontInterface = {
|
||||||
|
fontSize: 14,
|
||||||
|
fontColor: Colors.FullBlack,
|
||||||
|
fontFamily: Fonts.RobotoBold
|
||||||
|
}
|
||||||
|
|
||||||
|
export const theme = {
|
||||||
|
primaryColor: Colors.FullWhite,
|
||||||
|
secondaryColor: Colors.FullWhite,
|
||||||
|
ascentColor: Colors.FullBlack,
|
||||||
|
headerFont: defaultFont,
|
||||||
|
titleFont: defaultFont,
|
||||||
|
subTitleFont: defaultFont
|
||||||
|
}
|
||||||
|
|
||||||
|
export default styled
|
||||||
|
export { css, createGlobalStyle, keyframes, ThemeProvider }
|
||||||
13
app/client/src/constants/StyleConstants.tsx
Normal file
13
app/client/src/constants/StyleConstants.tsx
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
export type Color = "full-white" | "full-black"
|
||||||
|
|
||||||
|
export const Colors: { [id: string]: Color } = {
|
||||||
|
FullWhite: "full-white",
|
||||||
|
FullBlack: "full-black"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FontFamily = "Brandon-Regular" | "Roboto-Bold"
|
||||||
|
|
||||||
|
export const Fonts: { [id: string]: FontFamily } = {
|
||||||
|
BrandonRegular: "Brandon-Regular",
|
||||||
|
RobotoBold: "Roboto-Bold"
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import BaseComponent, { IComponentProps } from "./BaseComponent"
|
import BaseComponent, { IComponentProps } from "./BaseComponent"
|
||||||
import { ContainerOrientation } from "../constants/WidgetConstants"
|
import { ContainerOrientation } from "../constants/WidgetConstants"
|
||||||
import styled from "styled-components"
|
import styled from "../constants/DefaultTheme"
|
||||||
|
|
||||||
const Container = styled.div`
|
const Container = styled.div`
|
||||||
background: "black";
|
background: ${props => props.theme.primaryColor};
|
||||||
color: "black";
|
color: "black";
|
||||||
`
|
`
|
||||||
|
|
||||||
class ContainerComponent extends BaseComponent<IContainerProps> {
|
class ContainerComponent extends BaseComponent<IContainerProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container key={this.componentData.widgetId}>
|
||||||
{this.props.children
|
{this.props.children
|
||||||
? this.props.children.map(child => {
|
? this.props.children.map(child => {
|
||||||
return child
|
return child
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,13 @@ import { BrowserRouter, Route, Switch } from "react-router-dom"
|
||||||
import { createStore } from "redux"
|
import { createStore } from "redux"
|
||||||
import appReducer from "./reducers"
|
import appReducer from "./reducers"
|
||||||
import WidgetBuilderRegistry from "./utils/WidgetRegistry"
|
import WidgetBuilderRegistry from "./utils/WidgetRegistry"
|
||||||
|
import { ThemeProvider, theme } from "./constants/DefaultTheme"
|
||||||
|
|
||||||
WidgetBuilderRegistry.registerWidgetBuilders()
|
WidgetBuilderRegistry.registerWidgetBuilders()
|
||||||
const store = createStore(appReducer)
|
const store = createStore(appReducer)
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/" component={App} />
|
<Route exact path="/" component={App} />
|
||||||
|
|
@ -22,6 +24,7 @@ ReactDOM.render(
|
||||||
<Route component={PageNotFound} />
|
<Route component={PageNotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
</ThemeProvider>
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById("root")
|
document.getElementById("root")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ const initialState: CanvasReduxState = {
|
||||||
{
|
{
|
||||||
widgetId: "1",
|
widgetId: "1",
|
||||||
widgetType: "TEXT_WIDGET",
|
widgetType: "TEXT_WIDGET",
|
||||||
//text: "Hello World",
|
|
||||||
topRow: 0,
|
topRow: 0,
|
||||||
leftColumn: 0,
|
leftColumn: 0,
|
||||||
bottomRow: 5,
|
bottomRow: 5,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user