Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
better-wp-security
/
core
/
packages
/
ui
/
src
/
tabbed-navigation
:
index.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * WordPress dependencies */ import { createContext, useContext, useMemo } from '@wordpress/element'; /** * Solid dependencies */ import { TextSize, TextWeight } from '@ithemes/ui'; /** * Internal dependencies */ import { StyledNav, StyledTab, StyledTabTitle } from './styles'; const Context = createContext( { size: TextSize.LARGE, } ); export default function TabbedNavigation( { className, size = TextSize.LARGE, children } ) { const context = useMemo( () => ( { size } ), [ size ] ); return ( <StyledNav className={ className }> <Context.Provider value={ context }> { children } </Context.Provider> </StyledNav> ); } export function NavigationTab( { title, ...props } ) { const { size } = useContext( Context ); return ( <StyledTab { ...props }> <StyledTabTitle size={ size } weight={ TextWeight.HEAVY } text={ title } align="center" /> </StyledTab> ); }