Misc CSS and transition fixes

This commit is contained in:
Dane Everitt 2019-07-27 20:23:44 -07:00
parent df5de4be97
commit ecb5384579
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 24 additions and 13 deletions

View file

@ -10,7 +10,7 @@ export default ({ children }: Props) => (
<Route <Route
render={({ location }) => ( render={({ location }) => (
<TransitionGroup className={'route-transition-group'}> <TransitionGroup className={'route-transition-group'}>
<CSSTransition key={location.key} timeout={250} classNames={'fade'}> <CSSTransition key={location.key} timeout={250} in={true} appear={true} classNames={'fade'}>
<section> <section>
{children} {children}
<div className={'mx-auto w-full'} style={{ maxWidth: '1200px' }}> <div className={'mx-auto w-full'} style={{ maxWidth: '1200px' }}>

View file

@ -8,6 +8,8 @@ import WebsocketHandler from '@/components/server/WebsocketHandler';
import { ServerContext } from '@/state/server'; import { ServerContext } from '@/state/server';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import DatabasesContainer from '@/components/server/databases/DatabasesContainer'; import DatabasesContainer from '@/components/server/databases/DatabasesContainer';
import FileManagerContainer from '@/components/server/files/FileManagerContainer';
import { CSSTransition } from 'react-transition-group';
const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => { const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => {
const server = ServerContext.useStoreState(state => state.server.data); const server = ServerContext.useStoreState(state => state.server.data);
@ -23,6 +25,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
return ( return (
<React.Fragment> <React.Fragment>
<NavigationBar/> <NavigationBar/>
<CSSTransition timeout={250} classNames={'fade'} appear={true} in={true}>
<div id={'sub-navigation'}> <div id={'sub-navigation'}>
<div className={'mx-auto'} style={{ maxWidth: '1200px' }}> <div className={'mx-auto'} style={{ maxWidth: '1200px' }}>
<div className={'items'}> <div className={'items'}>
@ -33,6 +36,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
</div> </div>
</div> </div>
</div> </div>
</CSSTransition>
<Provider store={ServerContext.useStore()}> <Provider store={ServerContext.useStore()}>
<TransitionRouter> <TransitionRouter>
<div className={'w-full mx-auto'} style={{ maxWidth: '1200px' }}> <div className={'w-full mx-auto'} style={{ maxWidth: '1200px' }}>
@ -45,6 +49,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<WebsocketHandler/> <WebsocketHandler/>
<Switch location={location}> <Switch location={location}>
<Route path={`${match.path}`} component={ServerConsole} exact/> <Route path={`${match.path}`} component={ServerConsole} exact/>
<Route path={`${match.path}/files`} component={FileManagerContainer} exact/>
<Route path={`${match.path}/databases`} component={DatabasesContainer}/> <Route path={`${match.path}/databases`} component={DatabasesContainer}/>
</Switch> </Switch>
</React.Fragment> </React.Fragment>

View file

@ -4,6 +4,7 @@ import { FlashMessageType } from '@/components/MessageBox';
export interface FlashStore { export interface FlashStore {
items: FlashMessage[]; items: FlashMessage[];
addFlash: Action<FlashStore, FlashMessage>; addFlash: Action<FlashStore, FlashMessage>;
addError: Action<FlashStore, { message: string; key?: string }>;
clearFlashes: Action<FlashStore, string | void>; clearFlashes: Action<FlashStore, string | void>;
} }
@ -20,6 +21,9 @@ const flashes: FlashStore = {
addFlash: action((state, payload) => { addFlash: action((state, payload) => {
state.items.push(payload); state.items.push(payload);
}), }),
addError: action((state, payload) => {
state.items.push({ type: 'error', title: 'Error', ...payload });
}),
clearFlashes: action((state, payload) => { clearFlashes: action((state, payload) => {
state.items = payload ? state.items.filter(flashes => flashes.key !== payload) : []; state.items = payload ? state.items.filter(flashes => flashes.key !== payload) : [];
}), }),

View file

@ -1,9 +1,9 @@
/*! purgecss start ignore */ /*! purgecss start ignore */
.fade-enter { .fade-enter, .fade-appear {
@apply .opacity-0; @apply .opacity-0;
} }
.fade-enter-active { .fade-enter-active, .fade-appear-active {
@apply .opacity-100; @apply .opacity-100;
transition: opacity 250ms; transition: opacity 250ms;
} }

View file

@ -74,12 +74,14 @@
} }
&.spinner-blue { &.spinner-blue {
border: 3px solid hsla(212, 92%, 43%, 0.2); border-style: solid;
border-color: hsla(212, 92%, 43%, 0.2);
border-top-color: hsl(212, 92%, 43%); border-top-color: hsl(212, 92%, 43%);
} }
&.spinner-white { &.spinner-white {
border: 3px solid rgba(255, 255, 255, 0.2); border-style: solid;
border-color: rgba(255, 255, 255, 0.2);
border-top-color: rgb(255, 255, 255); border-top-color: rgb(255, 255, 255);
} }
} }