Skip to content

Commit d121479

Browse files
committed
feat(admin-ui): design the layout for api role management #327
1 parent 2403ff0 commit d121479

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

app/components/SidebarMenu/SidebarMenuItem.js

+23-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import { MenuContext } from './MenuContext'
1212
const SidebarMenuItemLink = (props) =>
1313
props.to || props.href ? (
1414
props.to ? (
15-
<Link to={props.to} style={props.textStyle} className={`${props.classBase}__entry__link`}>
15+
<Link
16+
to={props.to}
17+
style={props.textStyle}
18+
className={`${props.classBase}__entry__link`}
19+
>
1620
{props.children}
1721
</Link>
1822
) : (
@@ -42,7 +46,7 @@ SidebarMenuItemLink.propTypes = {
4246
onToggle: PropTypes.func,
4347
children: PropTypes.node,
4448
classBase: PropTypes.string,
45-
textStyle: PropTypes.object
49+
textStyle: PropTypes.object,
4650
}
4751

4852
/**
@@ -68,7 +72,7 @@ export class SidebarMenuItem extends React.Component {
6872
href: PropTypes.string,
6973
exact: PropTypes.bool,
7074
noCaret: PropTypes.bool,
71-
textStyle: PropTypes.object
75+
textStyle: PropTypes.object,
7276
}
7377

7478
static defaultProps = {
@@ -119,11 +123,11 @@ export class SidebarMenuItem extends React.Component {
119123
active: entry && entry.active,
120124
})
121125
const activeMenu = {
122-
color: 'white !important',
123-
backgroundColor: 'rgb(3, 169, 109)',
124-
}
125-
const nonaActiveMenu = {
126+
color: '#ffffff',
127+
background: 'linear-gradient(90deg, #00C9FF 0%, #92FE9D 100%)',
128+
fontWeight: 'bold',
126129
}
130+
const nonaActiveMenu = {}
127131

128132
function getStyle(itemClass) {
129133
if (
@@ -135,6 +139,17 @@ export class SidebarMenuItem extends React.Component {
135139
}
136140
return nonaActiveMenu
137141
}
142+
143+
function getTextStyle(itemClass) {
144+
if (
145+
itemClass.includes('active', 0) &&
146+
itemClass.includes('submenu__entry', 0) &&
147+
!itemClass.includes('open', 0)
148+
) {
149+
return { color: 'white', fontWeight: 'inherit' }
150+
}
151+
return null
152+
}
138153
return (
139154
<li
140155
style={getStyle(itemClass)}
@@ -148,7 +163,7 @@ export class SidebarMenuItem extends React.Component {
148163
href={this.props.href || null}
149164
onToggle={this.toggleNode.bind(this)}
150165
classBase={classBase}
151-
textStyle={this.props.textStyle}
166+
textStyle={getTextStyle(itemClass) || this.props.textStyle}
152167
>
153168
{this.props.icon &&
154169
React.cloneElement(this.props.icon, {

app/routes/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const RoutedContent = () => {
2626
state.token ? state.token.scopes : state.authReducer.permissions,
2727
)
2828
const [pluginMenus, setPluginMenus] = useState([])
29-
//console.log('==============' + JSON.stringify(scopes))
3029
useEffect(() => {
3130
setPluginMenus(processRoutes())
3231
}, [])

0 commit comments

Comments
 (0)