Fixes: Socket reconnecting when changing theme

This commit is contained in:
Tom Moor
2019-04-20 15:19:35 -07:00
parent eb638ba68d
commit 8f276731ed
10 changed files with 20 additions and 11 deletions

View File

@ -30,6 +30,7 @@ const Actions = styled(Flex)`
left: 0; left: 0;
border-radius: 3px; border-radius: 3px;
background: ${props => props.theme.background}; background: ${props => props.theme.background};
transition: ${props => props.theme.backgroundTransition};
padding: 12px; padding: 12px;
-webkit-backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);

View File

@ -126,6 +126,7 @@ class Layout extends React.Component<Props> {
const Container = styled(Flex)` const Container = styled(Flex)`
background: ${props => props.theme.background}; background: ${props => props.theme.background};
transition: ${props => props.theme.backgroundTransition};
position: relative; position: relative;
width: 100vw; width: 100vw;
min-height: 100%; min-height: 100%;

View File

@ -80,6 +80,7 @@ const StyledModal = styled(ReactModal)`
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
background: ${props => props.theme.background}; background: ${props => props.theme.background};
transition: ${props => props.theme.backgroundTransition};
padding: 13vh 2rem 2rem; padding: 13vh 2rem 2rem;
outline: none; outline: none;
`; `;

View File

@ -65,7 +65,7 @@ const Container = styled(Flex)`
left: ${props => (props.editMode ? `-${props.theme.sidebarWidth}` : 0)}; left: ${props => (props.editMode ? `-${props.theme.sidebarWidth}` : 0)};
width: 100%; width: 100%;
background: ${props => props.theme.sidebarBackground}; background: ${props => props.theme.sidebarBackground};
transition: left 100ms ease-out; transition: left 100ms ease-out, ${props => props.theme.backgroundTransition};
margin-left: ${props => (props.mobileSidebarVisible ? 0 : '-100%')}; margin-left: ${props => (props.mobileSidebarVisible ? 0 : '-100%')};
z-index: 2; z-index: 2;

View File

@ -32,13 +32,6 @@ class SidebarLink extends React.Component<Props> {
paddingLeft: `${(this.props.depth || 0) * 16 + 16}px`, paddingLeft: `${(this.props.depth || 0) * 16 + 16}px`,
}; };
activeStyle = {
color: this.props.theme.text,
background: this.props.theme.sidebarItemBackground,
fontWeight: 600,
...this.style,
};
componentDidMount() { componentDidMount() {
if (this.props.expanded) this.handleExpand(); if (this.props.expanded) this.handleExpand();
} }
@ -75,12 +68,18 @@ class SidebarLink extends React.Component<Props> {
exact, exact,
} = this.props; } = this.props;
const showDisclosure = !!children && !hideDisclosure; const showDisclosure = !!children && !hideDisclosure;
const activeStyle = {
color: this.props.theme.text,
background: this.props.theme.sidebarItemBackground,
fontWeight: 600,
...this.style,
};
return ( return (
<Wrapper menuOpen={menuOpen} column> <Wrapper menuOpen={menuOpen} column>
<StyledNavLink <StyledNavLink
activeStyle={this.activeStyle} activeStyle={activeStyle}
style={active ? this.activeStyle : this.style} style={active ? activeStyle : this.style}
onClick={onClick} onClick={onClick}
exact={exact !== false} exact={exact !== false}
to={to} to={to}

View File

@ -13,7 +13,7 @@ type Props = {
function Theme({ children, ui }: Props) { function Theme({ children, ui }: Props) {
return ( return (
<ThemeProvider theme={ui.theme === 'dark' ? dark : light} key={ui.theme}> <ThemeProvider theme={ui.theme === 'dark' ? dark : light}>
<React.Fragment> <React.Fragment>
<GlobalStyles /> <GlobalStyles />
{children} {children}

View File

@ -53,6 +53,10 @@ class DocumentEditor extends React.Component<Props> {
const StyledEditor = styled(Editor)` const StyledEditor = styled(Editor)`
justify-content: start; justify-content: start;
> div {
transition: ${props => props.theme.backgroundTransition};
}
p { p {
${Placeholder} { ${Placeholder} {
visibility: hidden; visibility: hidden;

View File

@ -56,6 +56,7 @@ const StyledInput = styled.input`
outline: none; outline: none;
border: 0; border: 0;
background: ${props => props.theme.sidebarBackground}; background: ${props => props.theme.sidebarBackground};
transition: ${props => props.theme.backgroundTransition};
border-radius: 4px; border-radius: 4px;
color: ${props => props.theme.text}; color: ${props => props.theme.text};

View File

@ -127,6 +127,7 @@ class Profile extends React.Component<Props> {
const DangerZone = styled.div` const DangerZone = styled.div`
background: ${props => props.theme.background}; background: ${props => props.theme.background};
transition: ${props => props.theme.backgroundTransition};
position: absolute; position: absolute;
bottom: 16px; bottom: 16px;
`; `;

View File

@ -45,6 +45,7 @@ export const base = {
"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen, Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif", "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen, Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif",
fontWeight: 400, fontWeight: 400,
link: colors.primary, link: colors.primary,
backgroundTransition: 'background 100ms ease-in-out',
}; };
export const light = { export const light = {