Skip to content

Commit

Permalink
isSelected
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmaguitar committed Aug 30, 2024
1 parent 1b3ed01 commit 98bdcb1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
5 changes: 4 additions & 1 deletion _app/src/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ const Examples = () => {
const onChangeSelection = ( [ selectedExampleSlug ] ) => {
setSelectedExample( selectedExampleSlug );
};

useEffect( () => {
if ( filterTags ) {
setSearchParams( { tags: filterTags, operator: filterOperator } );
Expand Down Expand Up @@ -220,12 +221,14 @@ const Examples = () => {
<_DataViews />
</div>
<div className="iframeContainer">
{ selectedExample && (
{ selectedExample ? (
<iframe
src={ `https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/WordPress/block-development-examples/trunk/plugins/${ selectedExample }/_playground/blueprint.json` }
title="Example Iframe" // Title for accessibility
loading="lazy" // Optional: Defer loading the iframe until it is visible
/>
) : (
<p>👈 Select an example to view the demo</p>
) }
</div>
</div>
Expand Down
20 changes: 18 additions & 2 deletions _app/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ body {
}

.iframeContainer {
width: 60%;
width: 50%;
height: 90vh;
float: left;

display: table;
}

.iframeContainer p {
text-align: center;
vertical-align: middle;
display: table-cell;
color: rgb(238, 55, 55);
font-size: 1.2em;
}
}

Expand All @@ -82,7 +93,7 @@ iframe {
}

.dataviews-view-list .dataviews-view-list__media-wrapper,
.dataviews-view-list li:not(.is-selected) .dataviews-view-list__primary-field {
.dataviews-view-list li .dataviews-view-list__primary-field {
display: none;
}

Expand All @@ -100,3 +111,8 @@ iframe {
.dataviews-view-list__fields > .dataviews-view-list__field:nth-of-type(5) {
flex: 1 1 100%;
}

.dataviews-view-list li.is-selected.is-selected {
background: #fcfcfc;
border-right: 4px solid rgb(20, 19, 19);
}

0 comments on commit 98bdcb1

Please sign in to comment.