// @flow import React from 'react'; import branch from 'recompose/branch'; import renderComponent from 'recompose/renderComponent'; import styled from 'styled-components'; import { Spinner, FlexCol } from '../globals'; import { Card } from '../card'; import { ThreadViewContainer, Detail, Content } from '../../views/thread/style'; import { ShimmerList, ShimmerListLite, ShimmerInboxThread, ShimmerThread, ShimmerThreadDetail, ShimmerThreadContent, ShimmerProfile, ShimmerProfileLite, ShimmerListItem, ShimmerDM, ShimmerInboxComposer, ShimmerComposer, ShimmerBase, ShimmerLine, ShimmerSelect, StyledErrorSelect, Cover, CircularCover, LoadingOverlay, LoadingNavbarContainer, LogoLink, Logo, } from './style'; /* Creates a container that fills the width and height of its parent and absolutely centers a loading spinner inside. Loading spinner takes a size and color. */ const LoadingContainer = styled.div` display: flex; flex: auto; align-self: stretch; align-items: center; justify-content: center; position: relative; `; const LoadingCardContainer = styled(Card)` flex: 1 1 auto; align-self: stretch; align-items: center; justify-content: center; position: relative; padding: 1rem; `; /* Outputs a spinner only with a transparent background that will fill to the width and height of its parent. Useful for inline spinners. */ export const Loading = ({ size, color, ...rest }: { size?: number, color?: string, }): React$Element => ( ); /* Outputs a spinner on top of a card. The card will fill the size of its parent. Useful for adding loading states to threads, profile components, the composer, etc */ export const LoadingCard = ({ size, color, }: { size?: Number, color?: String, }): React$Element => ( ); export const LoadingGallery = (): React$Element => ( ); export const LoadingNavbar = (): React$Element => ( ); export const LoadingThread = () => ( ); export const LoadingInboxThread = () => ( ); export const LoadingFeed = () => ( ); export const LoadingThreadDetail = () => ( ); export const LoadingThreadContent = () => ( ); export const LoadingListItem = () => ( ); export const LoadingListItemLite = () => ( ); export const LoadingList = () => ( ); export const LoadingListThreadDetail = () => ( ); export const LoadingDM = () => ( ); export const LoadingComposer = () => ( ); export const LoadingInboxComposer = () => ( ); export const LoadingProfile = () => ( ); export const LoadingProfileThreadDetail = () => ( ); export const LoadingSelect = () => ( ); type Props = { children: any }; export const ErrorSelect = ({ children }: Props) => ( {children} ); export const LoadingThreadView = (): React$Element => ( ); export const displayLoadingState = branch( props => !props.data || props.data.loading, renderComponent(Loading) ); export const displayLoadingGallery = branch( props => !props.data || props.data.loading, renderComponent(LoadingGallery) ); export const displayLoadingNavbar = branch( props => !props.data || props.data.loading || renderComponent(LoadingNavbar) ); export const displayLoadingCard = branch( props => !props.data || props.data.loading, renderComponent(LoadingCard) ); export const displayLoadingThreadView = branch( props => !props.data, renderComponent(LoadingThreadView) ); export const displayLoadingComposer = branch( props => !props.data.user && !props.data.error, renderComponent(LoadingComposer) );