mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 20:36:21 -05:00
Creating setting for changing navbar color.
This commit is contained in:
parent
9dd027b86b
commit
35ec6d44fe
7 changed files with 102 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import {NavLink} from "react-router-dom";
|
||||
import {Dropdown, Menu} from "semantic-ui-react";
|
||||
import {Media, ThemeContext} from "../contexts/contexts";
|
||||
import {Media, SettingsContext, ThemeContext} from "../contexts/contexts";
|
||||
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon";
|
||||
import {CPUTemperatureIcon, DarkModeToggle, HotspotStatusIcon, NAME, SystemLoadIcon} from "./Common";
|
||||
import {ShareButton} from "./Share";
|
||||
|
|
@ -61,10 +61,12 @@ function NavIconWrapper(props) {
|
|||
|
||||
export function NavBar() {
|
||||
const wrolModeEnabled = useWROLMode();
|
||||
const {settings} = React.useContext(SettingsContext);
|
||||
const wrolpiIcon = <img src='/icon.svg' height='32px' width='32px' alt='WROLPi Home Icon'/>;
|
||||
const name = <i>{NAME || wrolpiIcon}</i>;
|
||||
const topNavText = wrolModeEnabled ? <>{name} <Icon name='lock'/></> : name;
|
||||
const {i} = React.useContext(ThemeContext);
|
||||
const navColor = settings && settings.nav_color ? settings.nav_color : 'violet';
|
||||
|
||||
const homeLink = <NavLink className='item' to='/' style={{paddingTop: 0, paddingBottom: 0}}>
|
||||
{topNavText}
|
||||
|
|
@ -83,7 +85,7 @@ export function NavBar() {
|
|||
|
||||
return <>
|
||||
<Media at='mobile'>
|
||||
<Menu {...i} attached='top' color='violet'>
|
||||
<Menu {...i} attached='top' color={navColor}>
|
||||
{homeLink}
|
||||
<Menu.Menu position='right'>
|
||||
{icons}
|
||||
|
|
@ -96,7 +98,7 @@ export function NavBar() {
|
|||
</Menu>
|
||||
</Media>
|
||||
<Media greaterThanOrEqual='tablet'>
|
||||
<Menu {...i} attached='top' color='violet'>
|
||||
<Menu {...i} attached='top' color={navColor}>
|
||||
{homeLink}
|
||||
{links.map(i => <MenuLink link={i} key={i.key}/>)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue