Skip to content

Commit

Permalink
fix(MenuHeading): Fix MenuHeading style overrides (#2002)
Browse files Browse the repository at this point in the history
* Added className prop to MenuHeading to allow for style overrides

* chore: image-snapshot updates (#2003)

Co-authored-by: ElliotTheHuman <ElliotTheHuman@users.noreply.github.com>

* use styled system for style overrides (#2004)

* Fixed lint error in MenuList.story

* Added ColorProps to MenuHeading interface

* chore: image-snapshot updates (#2005)

Co-authored-by: ElliotTheHuman <ElliotTheHuman@users.noreply.github.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Daniel Christopher <dbchristopher@gmail.com>
  • Loading branch information
3 people committed Mar 5, 2021
1 parent 82e726d commit bb293d9
Show file tree
Hide file tree
Showing 26 changed files with 31 additions and 1 deletion.
Binary file modified packages/components/snapshots/Dialog/Height-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Dialog/Medium Content-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Dialog/Placement Cover-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Dialog/Placement Top-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Drawer/Open-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Drawer/Placement Left-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Drawer/Width-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldDateRange/Disabled-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldSelect/Inline-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldText/Basic-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldText/Icon After-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldText/Required-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldTextArea/Disabled-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldTextArea/Error-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldTimeSelect/Basic-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/FieldTimeSelect/Required-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/InputChips/Summary-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/Select/Error Placeholder-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/snapshots/SelectMulti/Error Values-snap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion packages/components/src/Menu/MenuHeading.tsx
Expand Up @@ -26,12 +26,25 @@

import React, { FC, useContext, useRef, RefObject } from 'react'
import styled from 'styled-components'
import {
ColorProps,
TypographyProps,
SpaceProps,
pickStyledProps,
} from '@looker/design-tokens'
import { Heading } from '../Text/Heading'
import { listItemDimensions } from '../List'
import { ListItemContext } from '../List/ListItemContext'
import { useElementVisibility } from './MenuHeading.hooks'

export const MenuHeading: FC<{ children: string }> = ({ children }) => {
interface MenuHeadingProps extends ColorProps, TypographyProps, SpaceProps {
children: string
}

export const MenuHeading: FC<MenuHeadingProps> = ({
children,
...restProps
}) => {
const labelShimRef: RefObject<any> = useRef()
const isLabelShimVisible = useElementVisibility(labelShimRef)

Expand All @@ -56,6 +69,7 @@ export const MenuHeading: FC<{ children: string }> = ({ children }) => {
lineHeight="xsmall"
px={px}
pb="xsmall"
{...pickStyledProps(restProps)}
>
{children}
</Heading>
Expand Down
16 changes: 16 additions & 0 deletions packages/components/src/Menu/MenuList.story.tsx
Expand Up @@ -123,6 +123,22 @@ export const Density = () => (
<DensityExample density={-3} />
</Grid>
)

export const MenuHeadingOverride = () => (
<MenuList>
<MenuHeading>Hello World</MenuHeading>
<MenuHeading
color="inform"
fontSize="small"
fontWeight="bold"
lineHeight="small"
py="xxsmall"
>
Custom Hello World
</MenuHeading>
</MenuList>
)

export default {
component: MenuList,
title: 'MenuList',
Expand Down

0 comments on commit bb293d9

Please sign in to comment.