-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Events: Show upcoming events close to the visitor
- Loading branch information
Showing
16 changed files
with
350 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
public_html/wp-content/themes/wporg-events-2023/images/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
public_html/wp-content/themes/wporg-events-2023/images/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../wp-content/themes/wporg-events-2023/postcss/patterns/event-list-filters-with-nearby.pcss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.wporg-events__nearby-chips { | ||
button::before { | ||
content: ""; | ||
width: 24px; | ||
height: 24px; | ||
display: inline-block; | ||
} | ||
|
||
#wporg-events__see-global::before { | ||
background-image: url( 'images/close.svg' ); | ||
} | ||
|
||
#wporg-events__see-nearby::before { | ||
background-image: url( 'images/location.svg' ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
public_html/wp-content/themes/wporg-events-2023/src/event-list-chips/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"name": "wporg/event-list-chips", | ||
"version": "0.1.0", | ||
"title": "WordPress Events List Chips", | ||
"category": "design", | ||
"icon": "list-view", | ||
"description": "Chips for filtering results from the wporg/event-list block", | ||
"textdomain": "wporg", | ||
"supports": { | ||
"anchor": true | ||
}, | ||
"editorScript": "file:./index.js" | ||
} |
17 changes: 17 additions & 0 deletions
17
public_html/wp-content/themes/wporg-events-2023/src/event-list-chips/edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
|
||
import { useBlockProps } from '@wordpress/block-editor'; | ||
import { Disabled } from '@wordpress/components'; | ||
import ServerSideRender from '@wordpress/server-side-render'; | ||
|
||
export default function Edit( { attributes, name } ) { | ||
return ( | ||
<div { ...useBlockProps() }> | ||
<Disabled> | ||
<ServerSideRender block={ name } attributes={ attributes } /> | ||
</Disabled> | ||
</div> | ||
); | ||
} |
15 changes: 15 additions & 0 deletions
15
public_html/wp-content/themes/wporg-events-2023/src/event-list-chips/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Edit from './edit'; | ||
import metadata from './block.json'; | ||
|
||
registerBlockType( metadata.name, { | ||
edit: Edit, | ||
save: () => null, | ||
} ); |
52 changes: 52 additions & 0 deletions
52
public_html/wp-content/themes/wporg-events-2023/src/event-list-chips/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Block Name: WordPress Event List Chips | ||
* Description: Chips for filtering results from the wporg/event-list block. | ||
*/ | ||
|
||
namespace WordPressdotorg\Theme\Events_2023\WordPress_Event_List_Chips; | ||
use WP_Block; | ||
|
||
add_action( 'init', __NAMESPACE__ . '\init' ); | ||
|
||
/** | ||
* Register the block. | ||
*/ | ||
function init() { | ||
register_block_type( | ||
dirname( __DIR__, 2 ) . '/build/event-list-chips', | ||
array( | ||
'render_callback' => __NAMESPACE__ . '\render', | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Render the block content. | ||
* | ||
* @param array $attributes Block attributes. | ||
* @param string $content Block default content. | ||
* @param WP_Block $block Block instance. | ||
* | ||
* @return string Returns the block markup. | ||
*/ | ||
function render( $attributes, $content, $block ) { | ||
$wrapper_attributes = get_block_wrapper_attributes( array( 'id' => $attributes['id'] ?? '' ) ); | ||
|
||
ob_start(); | ||
?> | ||
|
||
<div <?php echo $wrapper_attributes; ?>> | ||
<button id="wporg-events__see-global"> | ||
Showing events near me | ||
</button> | ||
|
||
<button id="wporg-events__see-nearby" class="wporg-events__hidden"> | ||
Showing global events | ||
</button> | ||
</div> | ||
|
||
<?php | ||
|
||
return ob_get_clean(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
}, | ||
"supports": { | ||
"align": true, | ||
"anchor": true, | ||
"color": { | ||
"background": true, | ||
"text": true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.