File size: 1,107 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import styled from '@emotion/styled';
import { translate } from 'i18n-calypso';
import { type TabType, TabTypes } from './header';
const Container = styled.div< { activeTab: TabType } >`
flex: ${ ( props ) => ( props.activeTab === TabTypes.desktop ? '0 300px' : null ) };
height: 280px;
display: flex;
align-items: center;
& > * {
border: 1px solid var( --studio-gray-5 );
border-radius: 6px;
}
`;
const UnavailableScreenshot = styled.div`
color: var( --studio-gray-50 );
background-color: var( --studio-gray-0 );
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
`;
const ScreenShot = styled.img`
max-height: 100%;
`;
export const ScreenshotThumbnail = ( props: {
src: string | undefined;
alt: string;
activeTab: TabType;
} ) => {
const { src, alt, activeTab, ...rest } = props;
return (
<Container activeTab={ activeTab }>
{ src === undefined ? (
<UnavailableScreenshot>{ translate( 'Screenshot unavailable' ) }</UnavailableScreenshot>
) : (
<ScreenShot src={ src } alt={ alt } { ...rest } />
) }
</Container>
);
};
|