File size: 1,110 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
import { Gridicon } from '@automattic/components';
import { useTranslate } from 'i18n-calypso';

// Returns React component with a localized label and optional icon
function button( label, icon ) {
	return () => {
		// eslint-disable-next-line wpcalypso/i18n-translate-identifier
		const tr = useTranslate();
		return (
			<strong>
				{ icon }
				{ icon && '\u00A0' /* NBSP between icon and label */ }
				{ tr( ...label ) }
			</strong>
		);
	};
}

// we use this translate because the i18n scripts are scanning for
// translate( string ) calls, but the runtime translation hooks are set up with
// the 'useTranslate' above
const translate = ( ...args ) => args;

export const AddNewButton = button( translate( 'Add New' ), <Gridicon icon="add-image" /> );
export const DoneButton = button( translate( 'Done' ) );
export const EditButton = button( translate( 'Edit' ) );
export const EditImageButton = button( translate( 'Edit Image' ), <Gridicon icon="pencil" /> );
export const SiteTitleButton = button( translate( 'Site Title' ) );
export const SiteTaglineButton = button( translate( 'Site Tagline' ) );