diff --git a/CHANGELOG.md b/CHANGELOG.md index a12917fc6..09470944b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -# 5.22.0 (2020-08-12) +# Next - [Copy] Add Copy component (by [@nkanderson](https://github.com/nkanderson) in [#270](https://github.com/puppetlabs/design-system/pull/270)) +- [Sidebar] Add `containerElement` prop to Sidebar.Item (by [@vine77](https://github.com/vine77) in [#279](https://github.com/puppetlabs/design-system/pull/279)) # 5.21.1 (2020-06-30) diff --git a/packages/design-system-website/styleguideComponents/ComponentsListRenderer.jsx b/packages/design-system-website/styleguideComponents/ComponentsListRenderer.jsx index 702473fc0..ab6b80ee0 100644 --- a/packages/design-system-website/styleguideComponents/ComponentsListRenderer.jsx +++ b/packages/design-system-website/styleguideComponents/ComponentsListRenderer.jsx @@ -31,6 +31,7 @@ export function ComponentsListRenderer({ items: allItems, ...rest }) { return ( - - {}} title="Home" icon="home" active /> - + {}} + title="Home" + icon="home" + active + containerElement="div" + /> {}} title="Code" icon="code" /> {}} title="Build" icon="build" count={5} /> @@ -82,9 +86,13 @@ Add the `minimized` boolean prop to Sidebar to render a narrow version with icon ariaLabel="Return to the home page" /> - - {}} title="Home" icon="home" active /> - + {}} + title="Home" + icon="home" + active + containerElement="div" + /> {}} title="Code" icon="code" /> {}} title="Build" icon="build" /> diff --git a/packages/react-components/source/react/library/sidebar/SidebarItem.js b/packages/react-components/source/react/library/sidebar/SidebarItem.js index 55189df4d..174935b3d 100644 --- a/packages/react-components/source/react/library/sidebar/SidebarItem.js +++ b/packages/react-components/source/react/library/sidebar/SidebarItem.js @@ -7,6 +7,7 @@ import TooltipHoverArea from '../tooltips/TooltipHoverArea'; const propTypes = { as: PropTypes.elementType, + containerElement: PropTypes.elementType, title: PropTypes.string.isRequired, icon: PropTypes.string, className: PropTypes.string, @@ -18,6 +19,7 @@ const propTypes = { const defaultProps = { as: 'a', + containerElement: 'li', icon: '', className: '', minimized: false, @@ -36,6 +38,7 @@ const SidebarItem = props => { count, badge: badgeProp, as: Component, + containerElement: ContainerComponent, ...rest } = props; @@ -96,7 +99,7 @@ const SidebarItem = props => { ); - return
  • {link}
  • ; + return {link}; }; SidebarItem.propTypes = propTypes; diff --git a/packages/react-components/source/scss/library/components/_sidebar.scss b/packages/react-components/source/scss/library/components/_sidebar.scss index c021f9dd5..032ae4d7f 100644 --- a/packages/react-components/source/scss/library/components/_sidebar.scss +++ b/packages/react-components/source/scss/library/components/_sidebar.scss @@ -22,7 +22,7 @@ $puppet-sidebar-item-color-active: $puppet-brand-primary !default; $puppet-sidebar-item-font-size: 16px !default; $puppet-sidebar-item-font-weight: $puppet-type-weight-normal !default; $puppet-sidebar-item-line-height: 40px !default; -$puppet-sidebar-item-margin: 2px 16px !default; +$puppet-sidebar-item-margin: 2px 0 !default; $puppet-sidebar-item-padding: 0 12px !default; $puppet-sidebar-item-title-padding: 4px 0 !default; @@ -42,7 +42,7 @@ $puppet-sidebar-label-font-size: 11px !default; $puppet-sidebar-label-line-height: $puppet-common-spacing-base * 2 !default; $puppet-sidebar-label-margin: $puppet-common-spacing-base * 6 0 $puppet-common-spacing-base * 2 !default; -$puppet-sidebar-label-padding: 0 $puppet-common-spacing-base * 6 0 !default; +$puppet-sidebar-label-padding: 0 $puppet-common-spacing-base * 2 0 !default; $puppet-sidebar-label-text-transform: uppercase !default; $puppet-sidebar-item-accordion-font-size: 14px !default; @@ -97,7 +97,7 @@ $puppet-sidebar-footer-meta-icon: 32px; flex: 1; height: inherit; overflow: auto; - padding: 16px 0; + padding: 16px; } // Sidebar section & items