-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Playlist block:Inherit more CSS #75256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
800d85b
simplify the playlist block's css
scruffian cf586d3
css similification and design fixes
scruffian be6d629
add editor styles
scruffian 436a5af
remove grid
scruffian 56f1b39
remove margin
scruffian e288c0e
remove editor styles
scruffian 6fe7a6b
remove context
scruffian 117a516
simplify buttons
scruffian 87bc4ad
replace grid units with variables
scruffian fa4cc19
use spacing variables
scruffian 75d0cf3
add a color the current item
scruffian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -51,6 +51,5 @@ | |
| }, | ||
| "reusable": false | ||
| }, | ||
| "editorStyle": "wp-block-playlist-track-editor", | ||
| "style": "wp-block-playlist-track" | ||
| } | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -35,19 +35,19 @@ function render_block_core_playlist_track( $attributes ) { | |
| $html = '<li ' . $wrapper_attributes . '>'; | ||
| $html .= '<button ' . $context . 'data-wp-on--click="actions.changeTrack" data-wp-bind--aria-current="state.isCurrentTrack" class="wp-block-playlist-track__button">'; | ||
|
|
||
| $html .= '<span class="wp-block-playlist-track__content">'; | ||
| if ( $title ) { | ||
| $html .= '<span class="wp-block-playlist-track__title">' . wp_kses_post( $title ) . '</span>'; | ||
| } | ||
| if ( $artist ) { | ||
| $html .= '<span class="wp-block-playlist-track__artist">' . wp_kses_post( $artist ) . '</span>'; | ||
| } | ||
| $html .= '</span>'; | ||
|
|
||
| if ( $length ) { | ||
| $html .= '<span class="wp-block-playlist-track__length">' . | ||
| sprintf( | ||
| /* translators: %s: track length in minutes:seconds */ | ||
| '<span class="screen-reader-text">' . esc_html__( 'Length: %s' ) . ' </span>', | ||
| $length | ||
| ); | ||
| $html .= '<span class="wp-block-playlist-track__length">'; | ||
| $html .= '<span class="screen-reader-text">' . esc_html__( 'Length:' ) . ' </span>'; | ||
| $html .= esc_html( $length ); | ||
| $html .= '</span>'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @scruffian I believe this change makes it difficult to translate it correctly in for example, korean? I don't think we can assume that the number should be after the text in all languages. @SergeyBiryukov may know for sure. |
||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,33 +1,58 @@ | ||
| @use "@wordpress/base-styles/variables" as *; | ||
|
|
||
| .wp-block-playlist-track { | ||
| border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent); | ||
| padding: $grid-unit-10; | ||
| &:has([aria-current="true"]) { | ||
| background-color: color-mix(in srgb, currentColor 10%, transparent); | ||
| } | ||
|
|
||
| &:hover { | ||
| background-color: color-mix(in srgb, currentColor 15%, transparent); | ||
| } | ||
|
|
||
| .wp-block-playlist__tracklist-show-numbers & { | ||
| counter-increment: playlist-track; | ||
| } | ||
|
|
||
| .wp-block-playlist-track__button { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| height: auto; | ||
| min-width: 100%; | ||
| padding: 0; | ||
| font-size: 14px; | ||
| align-items: center; | ||
| width: 100%; | ||
| padding: var(--wp--preset--spacing--20, 0.5em); | ||
| font-size: inherit; | ||
| font-family: inherit; | ||
| text-align: left; // Override default button text-align. | ||
| line-height: 1.5; | ||
| text-align: left; | ||
| background-color: transparent; | ||
| color: inherit; | ||
| border: 0; | ||
| border-radius: 1px; | ||
| outline-offset: 2px; | ||
| cursor: pointer; | ||
|
|
||
| .wp-block-playlist__tracklist-show-numbers &::before { | ||
| content: counter(playlist-track); | ||
| width: 2ch; | ||
| margin-right: var(--wp--preset--spacing--20, 0.5em); | ||
| font-size: 0.85em; | ||
| opacity: 0.7; | ||
| } | ||
|
|
||
| .wp-block-playlist-track__content { | ||
| flex: 1 1 0; | ||
| min-width: 0; | ||
| } | ||
|
|
||
| span { | ||
| margin-right: $grid-unit-10; | ||
| .wp-block-playlist-track__title { | ||
| display: block; | ||
| } | ||
|
|
||
| .wp-block-playlist-track__artist { | ||
| display: block; | ||
| font-size: 0.85em; | ||
| opacity: 0.7; | ||
| margin-top: 0.125em; | ||
| } | ||
|
|
||
| .wp-block-playlist-track__length { | ||
| margin-left: auto; | ||
| } | ||
| &[aria-current="true"] { | ||
| font-weight: 600; | ||
| font-size: 0.85em; | ||
| opacity: 0.7; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't exist