File size: 806 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
import { Card } from '@automattic/components';
import { connect } from 'react-redux';
import { getCurrentUser } from 'calypso/state/current-user/selectors';
import AuthorSelector from '../';

function AuthorSelectorExample( { primarySiteId, displayName } ) {
	return (
		<Card>
			<AuthorSelector siteId={ primarySiteId } allowSingleUser popoverPosition="bottom">
				<span>You are { displayName } </span>
			</AuthorSelector>
		</Card>
	);
}

const ConnectedAuthorSelectorExample = connect( ( state ) => {
	const user = getCurrentUser( state );
	if ( ! user ) {
		return {};
	}

	return {
		primarySiteId: user.primary_blog,
		displayName: user.display_name,
	};
} )( AuthorSelectorExample );

ConnectedAuthorSelectorExample.displayName = 'AuthorSelector';

export default ConnectedAuthorSelectorExample;