Skip to content

Commit 0a918ce

Browse files
author
Luke Bowerman
committed
0.9.8
1 parent 9450e75 commit 0a918ce

File tree

6 files changed

+82
-125
lines changed

6 files changed

+82
-125
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.9.8] - 2020-08-02
9+
10+
### Fixed
11+
12+
- `DialogContent` patch for IE11 display bug
13+
- `MenuItem` patch for IE11 display bug
14+
815
## [0.9.7] - 2020-07-27
916

1017
### Added

packages/components/src/Dialog/Layout/DialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const Outer = styled.div<{ borderBottom?: boolean }>`
119119
${({ borderBottom, theme: { colors } }) =>
120120
borderBottom && `border-bottom: 1px solid ${colors.ui2};`}
121121
122-
flex: 8;
122+
flex: 1 1 auto;
123123
overflow: auto;
124124
125125
&.overflow {

packages/components/src/Dialog/Layout/__snapshots__/DialogContent.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
exports[`DialogContent Snapshot - No overflow 1`] = `
44
.c0 {
5-
-webkit-flex: 8;
6-
-ms-flex: 8;
7-
flex: 8;
5+
-webkit-flex: 1 1 auto;
6+
-ms-flex: 1 1 auto;
7+
flex: 1 1 auto;
88
overflow: auto;
99
}
1010
@@ -42,9 +42,9 @@ exports[`DialogContent Snapshot - No overflow 1`] = `
4242

4343
exports[`DialogContent Snapshot 1`] = `
4444
.c0 {
45-
-webkit-flex: 8;
46-
-ms-flex: 8;
47-
flex: 8;
45+
-webkit-flex: 1 1 auto;
46+
-ms-flex: 1 1 auto;
47+
flex: 1 1 auto;
4848
overflow: auto;
4949
}
5050

packages/components/src/Menu/MenuItem.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@
2424
2525
*/
2626

27-
import { CompatibleHTMLProps } from '@looker/design-tokens'
27+
import {
28+
CompatibleHTMLProps,
29+
size,
30+
space,
31+
SizeProps,
32+
SpaceProps,
33+
} from '@looker/design-tokens'
2834
import { IconNames } from '@looker/icons'
2935
import styled from 'styled-components'
3036
import React, { FC, ReactNode, useContext, useState, useEffect } from 'react'
3137
import { useID } from '../utils/useID'
3238
import { Icon } from '../Icon'
3339
import { MenuContext, MenuItemContext } from './MenuContext'
34-
import { MenuItemLayout, MenuItemLayoutGrid } from './MenuItemLayout'
40+
import { MenuItemLayout } from './MenuItemLayout'
3541

3642
export interface MenuItemProps extends CompatibleHTMLProps<HTMLElement> {
3743
iconArtwork?: ReactNode
@@ -85,6 +91,7 @@ const MenuItemInternal: FC<MenuItemProps> = (props) => {
8591
}
8692

8793
const { setOpen } = useContext(MenuContext)
94+
8895
const handleOnClick = (event: React.MouseEvent<HTMLLIElement>) => {
8996
setFocusVisible(false)
9097
onClick && onClick(event)
@@ -115,7 +122,11 @@ const MenuItemInternal: FC<MenuItemProps> = (props) => {
115122
/>
116123
) : (
117124
renderIconPlaceholder && (
118-
<div data-testid={`menu-item-${renderedIconID}-icon-placeholder`} />
125+
<IconPlaceholder
126+
size={24 / (compact ? 1.25 : 1)}
127+
mr="xsmall"
128+
data-testid={`menu-item-${renderedIconID}-icon-placeholder`}
129+
/>
119130
)
120131
)
121132

@@ -127,19 +138,16 @@ const MenuItemInternal: FC<MenuItemProps> = (props) => {
127138
compact={compact}
128139
disabled={disabled}
129140
focusVisible={isFocusVisible}
130-
hasIcon={Boolean(renderedIcon)}
131141
onBlur={handleOnBlur}
132142
onClick={handleOnClick}
133143
onKeyUp={handleOnKeyUp}
134144
className={className}
135145
>
136146
<Component href={href} role="menuitem" target={target}>
137-
<MenuItemLayoutGrid>
138-
{renderedIcon}
139-
{children}
140-
</MenuItemLayoutGrid>
147+
{renderedIcon}
148+
<span>{children}</span>
149+
{detail && <Detail>{detail}</Detail>}
141150
</Component>
142-
{detail && <Detail>{detail}</Detail>}
143151
</MenuItemLayout>
144152
)
145153
}
@@ -152,3 +160,10 @@ const Detail = styled.div`
152160
margin-right: ${({ theme: { space } }) => space.medium};
153161
padding-left: ${({ theme: { space } }) => space.large};
154162
`
163+
164+
interface IconPlaceholderProps extends SizeProps, SpaceProps {}
165+
166+
const IconPlaceholder = styled.div<IconPlaceholderProps>`
167+
${size}
168+
${space}
169+
`

packages/components/src/Menu/MenuItemLayout.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { Icon } from '../Icon'
3333
export interface MenuListItemProps extends CompatibleHTMLProps<HTMLLIElement> {
3434
compact?: boolean
3535
focusVisible?: boolean
36-
hasIcon?: boolean
3736
}
3837

3938
/**
@@ -42,9 +41,7 @@ export interface MenuListItemProps extends CompatibleHTMLProps<HTMLLIElement> {
4241
*/
4342
const MenuItemWrapper = forwardRef(
4443
(props: MenuListItemProps, ref: Ref<HTMLLIElement>) => {
45-
return (
46-
<li {...omit(props, 'compact', 'focusVisible', 'hasIcon')} ref={ref} />
47-
)
44+
return <li {...omit(props, 'compact', 'focusVisible')} ref={ref} />
4845
}
4946
)
5047

@@ -59,8 +56,6 @@ export const MenuItemLayoutGrid = styled.div``
5956
export const MenuItemLayout = styled(MenuItemWrapper)`
6057
align-items: center;
6158
color: ${({ theme: { colors } }) => colors.text5};
62-
display: flex;
63-
flex-wrap: wrap;
6459
font-size: ${({ theme: { fontSizes } }) => fontSizes.small};
6560
font-weight: ${({ theme: { fontWeights } }) => fontWeights.normal};
6661
outline: none;
@@ -77,6 +72,7 @@ export const MenuItemLayout = styled(MenuItemWrapper)`
7772
border: none;
7873
color: inherit;
7974
cursor: pointer;
75+
display: flex;
8076
flex: 1;
8177
font-size: inherit;
8278
font-weight: inherit;
@@ -91,21 +87,13 @@ export const MenuItemLayout = styled(MenuItemWrapper)`
9187
position: relative;
9288
text-align: left;
9389
text-decoration: none;
90+
width: 100%;
9491
9592
&:hover,
9693
&:focus {
9794
color: inherit;
9895
text-decoration: none;
9996
}
100-
101-
${MenuItemLayoutGrid} {
102-
align-items: center;
103-
display: grid;
104-
grid-gap: ${({ compact, theme: { space } }) =>
105-
compact ? space.xsmall : space.small};
106-
grid-template-columns: ${({ hasIcon }) =>
107-
hasIcon ? '24px 1fr' : ' 1fr'};
108-
}
10997
}
11098
11199
${({ focusVisible, theme: { colors } }) =>

0 commit comments

Comments
 (0)