@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
1 lines • 1.49 kB
Source Map (JSON)
{"version":3,"file":"navigation-button.mjs","names":["Item","HStack"],"sources":["../src/navigation-button.tsx"],"sourcesContent":["import {\n\tNavigator,\n\t__experimentalItem as Item,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { IconWithCurrentColor } from './icon-with-current-color';\n\ninterface GenericNavigationButtonProps {\n\ticon?: any;\n\tchildren: React.ReactNode;\n\t[ key: string ]: any;\n}\n\nfunction GenericNavigationButton( {\n\ticon,\n\tchildren,\n\t...props\n}: GenericNavigationButtonProps ) {\n\treturn (\n\t\t<Item { ...props }>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ icon } size={ 24 } />\n\t\t\t\t\t<FlexItem>{ children }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n\ninterface NavigationButtonProps {\n\tpath: string;\n\ticon?: any;\n\tchildren: React.ReactNode;\n\t[ key: string ]: any;\n}\n\nexport function NavigationButtonAsItem( props: NavigationButtonProps ) {\n\treturn <Navigator.Button as={ GenericNavigationButton } { ...props } />;\n}\n"],"mappings":";;;;AAcA,SAAS,wBAAyB,EACjC,MACA,UACA,GAAG,SAC8B;CACjC,OACC,qBAACA,oBAAD;EAAM,GAAK;EAAX,UAAA,CACG,QACD,qBAACC,sBAAD;GAAQ,SAAQ;GAAhB,UAAA,CACC,oBAAC,sBAAD;IAA6B;IAAO,MAAO;GAAM,CAAA,GACjD,oBAAC,UAAD,EAAY,SAAoB,CAAA,CACzB;EAEP,CAAA,GAAA,CAAE,QAAQ,QACP;;AAER;AASA,SAAgB,uBAAwB,OAA+B;CACtE,OAAO,oBAAC,UAAU,QAAX;EAAkB,IAAK;EAA0B,GAAK;CAAS,CAAA;AACvE"}