app/api/dummy/brand.js
module.exports = {
name: 'Enlite Prime',
desc: 'Enlite Prime - React.js Fullstack Template',
prefix: 'enlite',
footerText: 'Enlite Prime All Rights Reserved 2019',
logoText: 'Enlite Prime',
};
app/redux/modules/uiReducer.js
initialState
value. Here's the available api:
Key | Type | Available Value | Example |
---|---|---|---|
theme: |
String |
'redTheme' ,
'blueTheme' , 'greenTheme' ,
'purpleTheme' , 'orangeTheme' ,
'greyTheme' ,
|
theme: 'greenTheme' |
layout: |
String |
'left-sidebar' ,
'right-sidebar' ,
'top-navigation' ,
'mega-menu' ,
|
layout: 'left-sidebar |
type: |
String |
'light' ,
'dark' ,
|
type: 'dark' |
direction: |
String |
ltr ,
rtl For RTL as default layout, please set up the HTML attribute as well. In /app/index.html please add dir="rtl
For lang attribute please follow the language you use
|
direction: 'rtl' |
// file: app/redux/modules/uiReducer.js
const initialState = {
/* Settings for Themes and layout */
theme: 'redTheme',
type: 'light', // light or dark
direction: 'ltr', // ltr or rtl
layout: 'big-sidebar', // sidebar, big-sidebar, top-navigation, mega-menu
/* End settings */
palette: List([
{ name: 'Red', value: 'redTheme' },
{ name: 'Green', value: 'greenTheme' },
{ name: 'Blue', value: 'blueTheme' },
{ name: 'Purple', value: 'purpleTheme' },
{ name: 'Orange', value: 'orangeTheme' },
{ name: 'Grey', value: 'greyTheme' },
]),
sidebarOpen: true,
pageLoaded: false,
subMenuOpen: []
};
All UI configuration above will be reseted once page reload. To make it permanent you can store the config in local storage with redux-persist plugins.
app/redux/configureStore.js
persistConfig.whitelist
add the reducer name['ui']
// file: app/redux/configureStore.js
const persistConfig = {
key: 'dandelion',
storage,
whitelist: ['ui']
};
whitelist
to save the state in local storage. If you want to reset them, just clear the local storage.This theme has two theme mode, dark and light. To change default color you can find in
app/api/palette/lightPalette.js
app/api/palette/darkPalette.js
Every kind of themes has two palette, there are primary and secondary within light, main, dark and contrastText. Just change the value as you like. In example if you want to change purpleRedTheme
in dark mode
// app/api/palette/darkPalette.js
purpleRedTheme: {
palette: {
primary: {
light: '#EDE7F6',
main: '#673AB7',
dark: '#512DA8',
contrastText: '#fff',
},
secondary: {
light: '#FCE4EC',
main: '#EC407A',
dark: '#C2185B',
contrastText: '#fff',
},
},
},
This is UI architecture in diagram visuailzation. Click diagram or full screen button to show in new tab with full screen
app/i18n.js
const DEFAULT_LOCALE = 'en';
to other initial locale i.e. id
for Bahasa Indonesia
// messages.js
/*
* Todo App Messages
*
* This contains all the text for the Todo App.
*/
import { defineMessages } from 'react-intl';
export const scope = 'boilerplate.components.Todo';
export default defineMessages({
title: {
id: `${scope}.title`,
defaultMessage: 'To Do Apps',
},
subtitle: {
id: `${scope}.subtitle`,
defaultMessage: 'All Your to do list. Just check it whenever You done.',
},
placeholder: {
id: `${scope}.placeholder`,
defaultMessage: 'What needs to be done?',
},
hint: {
id: `${scope}.hint`,
defaultMessage: 'Press enter to submit task',
},
view_all: {
id: `${scope}.filter.view_all`,
defaultMessage: 'View All',
},
active: {
id: `${scope}.filter.active`,
defaultMessage: 'Active',
},
completed: {
id: `${scope}.filter.completed`,
defaultMessage: 'Completed',
},
});
messages.js
app/translation
app/i18n.js
import messages from './messages';
react-intl
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
intl
to props
intl: intlShape.isRequired
<YourComponent>
<FormattedMessage {...messages[item.key]} />
</YourComponent>
<YourComponent text={intl.formatMessage(messages[item.key])} />
injectIntl
export default injectIntl(Sidebar);