Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix CSS for IE11 #13159

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/components/src/Loader/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EventSource, CONFIG_TYPE } from 'global';
import { transparentize } from 'polished';
import React, { ComponentProps, FunctionComponent, useEffect, useState } from 'react';
import { styled, keyframes } from '@storybook/theming';
import { Icons } from '../icon/icon';
Expand Down Expand Up @@ -44,7 +45,7 @@ const ProgressTrack = styled.div(({ theme }) => ({
maxWidth: 300,
height: 5,
borderRadius: 5,
background: `${theme.color.secondary}33`,
background: transparentize(0.8, theme.color.secondary),
overflow: 'hidden',
cursor: 'progress',
}));
Expand Down
7 changes: 7 additions & 0 deletions lib/core/src/server/templates/base-preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
box-sizing: border-box;
}

/* Vertical centering fix for IE11 */
.sb-show-main.sb-main-centered:after {
content: '';
min-height: inherit;
font-size: 0;
}

.sb-show-main.sb-main-fullscreen {
margin: 0;
padding: 0;
Expand Down
28 changes: 15 additions & 13 deletions lib/ui/src/components/sidebar/HighlightStyles.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { transparentize } from 'polished';
import React, { FunctionComponent } from 'react';
import { Global } from '@storybook/theming';
import { Highlight } from './types';

export const HighlightStyles: FunctionComponent<Highlight> = ({ refId, itemId }) => (
<Global
styles={({ color }) => ({
[`[data-ref-id="${refId}"][data-item-id="${itemId}"]:not([data-selected="true"])`]: {
[`&[data-nodetype="component"], &[data-nodetype="group"]`]: {
background: `${color.secondary}22`,
'&:hover, &:focus': {
background: `${color.secondary}22`,
styles={({ color }) => {
const background = transparentize(0.85, color.secondary);
return {
[`[data-ref-id="${refId}"][data-item-id="${itemId}"]:not([data-selected="true"])`]: {
[`&[data-nodetype="component"], &[data-nodetype="group"]`]: {
background,
'&:hover, &:focus': { background },
},
[`&[data-nodetype="story"], &[data-nodetype="document"]`]: {
color: color.defaultText,
background,
'&:hover, &:focus': { background },
},
},
[`&[data-nodetype="story"], &[data-nodetype="document"]`]: {
color: color.defaultText,
background: `${color.secondary}22`,
'&:hover, &:focus': { background: `${color.secondary}22` },
},
},
})}
};
}}
/>
);
3 changes: 2 additions & 1 deletion lib/ui/src/components/sidebar/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { styled } from '@storybook/theming';
import { Icons } from '@storybook/components';
import Downshift, { DownshiftState, StateChangeOptions } from 'downshift';
import Fuse, { FuseOptions } from 'fuse.js';
import { transparentize } from 'polished';
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';

import { DEFAULT_REF_ID } from './data';
Expand Down Expand Up @@ -75,7 +76,7 @@ const Input = styled.input(({ theme }) => ({
height: 28,
paddingLeft: 28,
paddingRight: 28,
border: `1px solid ${theme.color.mediumdark}66`,
border: `1px solid ${transparentize(0.6, theme.color.mediumdark)}`,
background: 'transparent',
borderRadius: 28,
fontSize: `${theme.typography.size.s1}px`,
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/src/components/sidebar/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, {
useEffect,
} from 'react';
import { ControllerStateAndHelpers } from 'downshift';
import { transparentize } from 'polished';

import { ComponentNode, DocumentNode, Path, RootNode, StoryNode } from './TreeNode';
import {
Expand All @@ -33,8 +34,11 @@ const ResultRow = styled.li<{ isHighlighted: boolean }>(({ theme, isHighlighted
display: 'block',
margin: 0,
padding: 0,
background: isHighlighted ? `${theme.color.secondary}11` : 'transparent',
background: isHighlighted ? transparentize(0.9, theme.color.secondary) : 'transparent',
cursor: 'pointer',
'a:hover, button:hover': {
background: 'transparent',
},
}));

const NoResults = styled.div(({ theme }) => ({
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/src/components/sidebar/TreeNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { styled, Color, Theme } from '@storybook/theming';
import { Icons } from '@storybook/components';
import { DOCS_MODE } from 'global';
import { transparentize } from 'polished';
import React, { FunctionComponent, ComponentProps } from 'react';

export const CollapseIcon = styled.span<{ isExpanded: boolean }>(({ theme, isExpanded }) => ({
Expand All @@ -12,7 +13,7 @@ export const CollapseIcon = styled.span<{ isExpanded: boolean }>(({ theme, isExp
marginRight: 5,
borderTop: '3px solid transparent',
borderBottom: '3px solid transparent',
borderLeft: `3px solid ${theme.color.mediumdark}99`,
borderLeft: `3px solid ${transparentize(0.4, theme.color.mediumdark)}`,
transform: isExpanded ? 'rotateZ(90deg)' : 'none',
transition: 'transform .1s ease-out',
}));
Expand Down