Nextjs Core Fixedplugin
-
Pro Component
This component is the right menu and its purpose is so you can
easily customize the left menu.
It is only rendered inside the
layouts/Admin.js
and
layouts/RTL.js
layouts.
Style
You will find the styles for this component in
assets/scss/nextjs-material-dashboard-pro/_fixed-plugin.scss
and
assets/css/nextjs-material-dashboard.css
.
For a better understaing please, take a look inside
layouts/Admin.js
and
components/FixedPlugin/FixedPlugin.js
.
Example free
Example of how it would be rendered
import React from " react " ;
// @material-ui/core components
// core components
import FixedPlugin from " components/FixedPlugin/FixedPlugin.js " ;
import bgImage from " assets/img/sidebar-2.jpg " ;
import logo from " assets/img/reactlogo.png " ;
export default function YourComponent () {
// states and functions
const [ image , setImage ] = React . useState ( bgImage );
const [ color , setColor ] = React . useState ( " white " );
const [ fixedClasses , setFixedClasses ] = React . useState ( " dropdown show " );
const handleImageClick = ( image ) => {
setImage ( image );
};
const handleColorClick = ( color ) => {
setColor ( color );
};
const handleFixedClick = () => {
if ( fixedClasses === " dropdown " ) {
setFixedClasses ( " dropdown show " );
} else {
setFixedClasses ( " dropdown " );
}
};
return (
... other code
< FixedPlugin
handleImageClick = { handleImageClick }
handleColorClick = { handleColorClick }
bgColor = { color }
bgImage = { image }
handleFixedClick = { handleFixedClick }
fixedClasses = { fixedClasses }
/ >
... other code
);
}
Example pro
Example of how it would be rendered
import React from " react " ;
... other code
import FixedPlugin from " components/FixedPlugin/FixedPlugin.js " ;
... other code
export default function YourComponent () {
... other code
// states and functions
const [ mobileOpen , setMobileOpen ] = React . useState ( false );
const [ miniActive , setMiniActive ] = React . useState ( false );
const [ image , setImage ] = React . useState ( require ( " assets/img/sidebar-2.jpg " ));
const [ color , setColor ] = React . useState ( " blue " );
const [ bgColor , setBgColor ] = React . useState ( " black " );
const [ fixedClasses , setFixedClasses ] = React . useState ( " dropdown " );
const [ logo , setLogo ] = React . useState ( require ( " assets/img/logo-white.svg " ));
... other code
// functions for changeing the states from components
const handleImageClick = image => {
setImage ( image );
};
const handleColorClick = color => {
setColor ( color );
};
const handleBgColorClick = bgColor => {
switch ( bgColor ) {
case " white " :
setLogo ( require ( " assets/img/logo.svg " ));
break ;
default :
setLogo ( require ( " assets/img/logo-white.svg " ));
break ;
}
setBgColor ( bgColor );
};
const handleFixedClick = () => {
if ( fixedClasses === " dropdown " ) {
setFixedClasses ( " dropdown show " );
} else {
setFixedClasses ( " dropdown " );
}
};
const sidebarMinimize = () => {
setMiniActive ( ! miniActive );
};
... other code
return (
... other code
< FixedPlugin
handleImageClick = { handleImageClick }
handleColorClick = { handleColorClick }
handleBgColorClick = { handleBgColorClick }
color = { color }
bgColor = { bgColor }
bgImage = { image }
handleFixedClick = { handleFixedClick }
fixedClasses = { fixedClasses }
sidebarMinimize = { sidebarMinimize . bind ( this )}
miniActive = { miniActive }
/ >
... other code
);
}
... other code
Props free
FixedPlugin . propTypes = {
bgImage : PropTypes . string ,
handleFixedClick : PropTypes . func ,
rtlActive : PropTypes . bool ,
fixedClasses : PropTypes . string ,
bgColor : PropTypes . oneOf ([
" white " ,
" purple " ,
" blue " ,
" green " ,
" orange " ,
" red " ,
]),
handleColorClick : PropTypes . func ,
handleImageClick : PropTypes . func ,
};
Props pro
FixedPlugin . propTypes = {
bgImage : PropTypes . string ,
handleFixedClick : PropTypes . func ,
miniActive : PropTypes . bool ,
fixedClasses : PropTypes . string ,
bgColor : PropTypes . oneOf ([ " white " , " black " , " blue " ]),
color : PropTypes . oneOf ([
" white " ,
" red " ,
" orange " ,
" green " ,
" blue " ,
" purple " ,
" rose " ,
]),
handleBgColorClick : PropTypes . func ,
handleColorClick : PropTypes . func ,
handleImageClick : PropTypes . func ,
sidebarMinimize : PropTypes . func ,
rtlActive : PropTypes . bool ,
};