import * as React from 'react'
import {_x} from '@wordpress/i18n'

import {
	URLPicker as SkaURLPicker,
	URLPickerStrings,
	URLPickerStringsContext,
} from '@ska/components'

const STRINGS: URLPickerStrings = {
	linkButtonLabel: _x('Link', 'url-picker', 'ska-blocks'),
	unlinkButtonLabel: _x('Unlink', 'url-picker', 'ska-blocks'),
}

export const URLPickerStringsProvider: React.FC<{children: React.ReactNode}> = (props) => (
	<URLPickerStringsContext.Provider value={STRINGS}>
		{props.children}
	</URLPickerStringsContext.Provider>
)

const URLPicker: typeof SkaURLPicker = (props) => (
	<URLPickerStringsProvider>
		<SkaURLPicker {...props} />
	</URLPickerStringsProvider>
)

export default URLPicker
