feat: add new theme berry (#860)

* feat: add theme berry

* docs: add development notes

* fix: fix blank page

* chore: update implementation

* fix: fix package.json

* chore: update ui copy

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
Buer
2024-01-07 14:20:07 +08:00
committed by GitHub
parent 6227eee5bc
commit 48989d4a0b
157 changed files with 13979 additions and 5 deletions

View File

@@ -0,0 +1,24 @@
import * as actionTypes from './actions';
export const initialState = {
user: undefined
};
const accountReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.LOGIN:
return {
...state,
user: action.payload
};
case actionTypes.LOGOUT:
return {
...state,
user: undefined
};
default:
return state;
}
};
export default accountReducer;

View File

@@ -0,0 +1,9 @@
// action - customization reducer
export const SET_MENU = '@customization/SET_MENU';
export const MENU_TOGGLE = '@customization/MENU_TOGGLE';
export const MENU_OPEN = '@customization/MENU_OPEN';
export const SET_FONT_FAMILY = '@customization/SET_FONT_FAMILY';
export const SET_BORDER_RADIUS = '@customization/SET_BORDER_RADIUS';
export const SET_SITE_INFO = '@siteInfo/SET_SITE_INFO';
export const LOGIN = '@account/LOGIN';
export const LOGOUT = '@account/LOGOUT';

View File

@@ -0,0 +1,4 @@
// theme constant
export const gridSpacing = 3;
export const drawerWidth = 260;
export const appDrawerWidth = 320;

View File

@@ -0,0 +1,46 @@
// project imports
import config from 'config';
// action - state management
import * as actionTypes from './actions';
export const initialState = {
isOpen: [], // for active default menu
defaultId: 'default',
fontFamily: config.fontFamily,
borderRadius: config.borderRadius,
opened: true
};
// ==============================|| CUSTOMIZATION REDUCER ||============================== //
const customizationReducer = (state = initialState, action) => {
let id;
switch (action.type) {
case actionTypes.MENU_OPEN:
id = action.id;
return {
...state,
isOpen: [id]
};
case actionTypes.SET_MENU:
return {
...state,
opened: action.opened
};
case actionTypes.SET_FONT_FAMILY:
return {
...state,
fontFamily: action.fontFamily
};
case actionTypes.SET_BORDER_RADIUS:
return {
...state,
borderRadius: action.borderRadius
};
default:
return state;
}
};
export default customizationReducer;

View File

@@ -0,0 +1,9 @@
import { createStore } from 'redux';
import reducer from './reducer';
// ==============================|| REDUX - MAIN STORE ||============================== //
const store = createStore(reducer);
const persister = 'Free';
export { store, persister };

View File

@@ -0,0 +1,16 @@
import { combineReducers } from 'redux';
// reducer import
import customizationReducer from './customizationReducer';
import accountReducer from './accountReducer';
import siteInfoReducer from './siteInfoReducer';
// ==============================|| COMBINE REDUCER ||============================== //
const reducer = combineReducers({
customization: customizationReducer,
account: accountReducer,
siteInfo: siteInfoReducer
});
export default reducer;

View File

@@ -0,0 +1,18 @@
import config from 'config';
import * as actionTypes from './actions';
export const initialState = config.siteInfo;
const siteInfoReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.SET_SITE_INFO:
return {
...state,
...action.payload
};
default:
return state;
}
};
export default siteInfoReducer;