give
/
src
/
EventTickets
/
resources
/
blocks
/
EventTicketsBlock
/
Edit
/
BlockPlaceholderSelectEvent.tsx
components
2 years ago
BlockInspectorControls.tsx
2 years ago
BlockPlaceholder.tsx
1 year ago
BlockPlaceholderNoEvents.tsx
2 years ago
BlockPlaceholderSelectEvent.tsx
2 years ago
index.tsx
2 years ago
styles.scss
1 year ago
BlockPlaceholderSelectEvent.tsx
28 lines
| 1 | import {__} from '@wordpress/i18n'; |
| 2 | import {SelectControl} from '@wordpress/components'; |
| 3 | |
| 4 | /** |
| 5 | * @since 3.6.0 |
| 6 | */ |
| 7 | export default function BlockPlaceholderSelectEvent({attributes, setAttributes}) { |
| 8 | const {events} = window.eventTicketsBlockSettings; |
| 9 | const eventOptions = |
| 10 | events.map((event) => { |
| 11 | return {label: event.title, value: `${event.id}`}; |
| 12 | }) ?? []; |
| 13 | |
| 14 | return ( |
| 15 | <div className={'givewp-event-tickets-block__placeholder--select-event'}> |
| 16 | <p> |
| 17 | <strong>{__('No event selected yet', 'give')}</strong> |
| 18 | </p> |
| 19 | <SelectControl |
| 20 | label={__('Select your preferred event for this donation form', 'give')} |
| 21 | value={`${attributes.eventId}`} |
| 22 | options={[{label: 'Select', value: ''}, ...eventOptions]} |
| 23 | onChange={(value: string) => setAttributes({eventId: Number(value)})} |
| 24 | /> |
| 25 | </div> |
| 26 | ); |
| 27 | } |
| 28 |