Center logo

This commit is contained in:
Roman Hotsiy 2017-11-23 11:38:18 +02:00
parent 0faa66b6e6
commit 14566b3e30
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import { OpenAPIInfo } from '../../types'; import { OpenAPIInfo } from '../../types';
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { LogoImgEl } from './styled.elements'; import { LogoImgEl, LogoWrap } from './styled.elements';
const LinkWrap = url => Component => <a href={url}>{Component}</a>; const LinkWrap = url => Component => <a href={url}>{Component}</a>;
@ -15,6 +15,10 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> {
const logo = ( const logo = (
<LogoImgEl src={logoInfo.url} style={{ backgroundColor: logoInfo.backgroundColor }} /> <LogoImgEl src={logoInfo.url} style={{ backgroundColor: logoInfo.backgroundColor }} />
); );
return info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo; return (
<LogoWrap>
{info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo}{' '}
</LogoWrap>
);
} }
} }

View File

@ -6,3 +6,7 @@ export const LogoImgEl = styled.img`
display: inline-block; display: inline-block;
max-width: 100%; max-width: 100%;
`; `;
export const LogoWrap = styled.div`
text-align: center;
`;