Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-antd-sider-menus
Advanced tools
Based on antd, menu props mode is inline. solve the problem of refreshing the route, jump routing, Layout.Sider collapsed from false to true, and when the collapsed is true, the dropdown is mistaken for the bug.
Based on antd, menu props mode is inline. solve the problem of refreshing the route, jump routing, Layout.Sider collapsed from false to true, and when the collapsed is true, the dropdown is mistaken for the bug.
yarn add react-antd-sider-menus
npm install --save react-antd-sider-menus
<script src="https://unpkg.com/react-antd-sider-menus@0.1.0/dist/index.umd.js"></script>
OR
<script src="https://unpkg.com/react-antd-sider-menus@0.1.0/dist/index.umd.min.js"></script>
Tips: You can find the library on window.ReactAntdSiderMenus.
import ReactAntdSiderMenus from 'react-antd-sider-menus'
const ReactAntdSiderMenus = require('react-antd-sider-menus')
import React, { useReducer } from 'react'
import ReactAntdSiderMenus from 'react-antd-sider-menus'
const initial = {
menus: [], // set self project menus
collapsed: false,
key: [],
keyPath: [],
cacheKeyPath: [],
breadRouters: []
}
const reducer = (state, action) => {
const payload = reap(action, 'payload', {})
switch (action.type) {
case 'update':
return { ...state, ...payload }
default:
throw new Error()
}
}
function Example() {
const {} = props
const [
{ menus = [], collapsed = false, key = [], keyPath = [], cacheKeyPath = [], breadRouters = [] },
dispatch
] = useReducer(reducer, initial)
const screenWidth = 1200 // listener screen resize
const siderMenusWidth = '320px'
const locationPathname = '' // listener browser router pathname change
return (
<ReactAntdSiderMenus
screenWidth={screenWidth}
locationPathname={locationPathname}
antdSider={{
classNameSider: '',
styleSider: { height: '100%', overflowX: 'hidden', overflowY: 'auto' },
widthSider: siderMenusWidth,
collapsedWidth: 64
}}
siderMenus={{
menus,
collapsed,
key,
keyPath,
cacheKeyPath,
breadRouters
}}
onChangeSiderMenus={value =>
dispatch({
type: 'update',
payload: {
...value
}
})
}
firstLevelSubMenuIconStyle={{ style: {} }}
firstLevelMenuItemIconStyle={{ style: {} }}
/>
)
}
Type number, isRequired, Default 0. Screen resize listener change.
Type string, isRequired, Default ''. Browser location pathname.
Antd Layout Sider props. Type object.
Property | Description | Type | Default | isRequired |
---|---|---|---|---|
classNameSider | React className property | string | '' | false |
styleSider | React style property | object | {} | false |
widthSider | Antd Sider component width, by the screenWidth change to set value. | string|number | '320px' | false |
collapsedWidth | Antd Sider component prop collapsed is true, sider's width. | number | 80 | false |
Menu operation data. Type object. isRequired. We can update using onChangeSiderMenus.
Property | Description | Type | Default | isRequired |
---|---|---|---|---|
menus | Data for rendering menu options. menus | array | [] | true |
collapsed | Whether to shrink the antd sider component. | bool | false | true |
key | Antd menu component prop selectedKeys, the currently selected menu item. | array | [] | true |
keyPath | Antd menu component prop openKeys, The current menu item expanded. | array | [] | true |
cacheKeyPath | Solve problems with caching keyPath. Type array. | array | [] | true |
breadRouters | Back to top selected all parents (contain: selected menu item). | array | [] | true |
menus = [
{
name: '开始', // show real name OR umi-plugin-local key
router: '/start', // Uniquely identifies. Also location pathname exact match.
icon: Setting, // Unselected Svg Component. Only first level has icon
selectIcon: SettingSelect // Selected Svg Component. Only first level has icon
},
{
name: 'MANAGEMENT',
router: '/management',
icon: Setting,
selectIcon: SettingSelect,
children: [
// submenu show router item
{
name: 'SETTING',
router: '/management/setting', // Inheriting the previous layer of routing.
children: [
{
name: 'SETTING',
router: '/management/setting/rule'
}
]
}
]
}
]
Type function(siderMenusValues), isRequired. Update some of siderMenus object states.
Type object, Default {}. The first level has a submenu icon.
Property | Description | Type | Default | isRequired |
---|---|---|---|---|
className | React className property | string | '' | false |
style | React style property | object | {} | false |
Type object, Default {}. The first level does not have a sub-menu icon.
Property | Description | Type | Default | isRequired |
---|---|---|---|---|
className | React className property | string | '' | false |
style | React style property | object | {} | false |
FAQs
Based on antd, menu props mode is inline. solve the problem of refreshing the route, jump routing, Layout.Sider collapsed from false to true, and when the collapsed is true, the dropdown is mistaken for the bug.
The npm package react-antd-sider-menus receives a total of 2 weekly downloads. As such, react-antd-sider-menus popularity was classified as not popular.
We found that react-antd-sider-menus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.