File size: 2,122 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
import { Gridicon, Button } from '@automattic/components';
import { localize } from 'i18n-calypso';
import PropTypes from 'prop-types';
import FollowButton from 'calypso/blocks/follow-button/button';
import AutoDirection from 'calypso/components/auto-direction';
import NavigationHeader from 'calypso/components/navigation-header';
import { isExternal } from 'calypso/lib/url';
import ReaderFollowFeedIcon from 'calypso/reader/components/icons/follow-feed-icon';
import ReaderFollowingFeedIcon from 'calypso/reader/components/icons/following-feed-icon';
const ListStreamHeader = ( {
isPublic,
title,
description,
showEdit,
editUrl,
showFollow,
following,
onFollowToggle,
translate,
} ) => {
const formattedTitle = (
<AutoDirection>
<div>{ title }</div>
</AutoDirection>
);
const formattedDescription = (
<AutoDirection>
<div>{ description }</div>
</AutoDirection>
);
return (
<AutoDirection>
<NavigationHeader title={ formattedTitle } subtitle={ formattedDescription }>
{ ! isPublic && (
<div className="list-stream__header-title-privacy">
<Gridicon icon="lock" size={ 24 } title={ translate( 'Private list' ) } />
</div>
) }
{ showFollow && (
<div className="list-stream__header-follow">
<FollowButton
iconSize={ 24 }
following={ following }
onFollowToggle={ onFollowToggle }
followIcon={ ReaderFollowFeedIcon( { iconSize: 24 } ) }
followingIcon={ ReaderFollowingFeedIcon( { iconSize: 24 } ) }
/>
</div>
) }
{ showEdit && editUrl && (
<div className="list-stream__header-edit">
<Button rel={ isExternal( editUrl ) ? 'external' : '' } href={ editUrl }>
{ translate( 'Edit' ) }
</Button>
</div>
) }
</NavigationHeader>
</AutoDirection>
);
};
ListStreamHeader.propTypes = {
isPublic: PropTypes.bool,
title: PropTypes.string,
description: PropTypes.string,
showEdit: PropTypes.bool,
editUrl: PropTypes.string,
showFollow: PropTypes.bool,
following: PropTypes.bool,
onFollowToggle: PropTypes.func,
};
export default localize( ListStreamHeader );
|