Skip to content

Commit

Permalink
feat: rename 'badge' element and break into own SCSS file
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford committed Apr 25, 2024
1 parent f3b717b commit 41a60ea
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
14 changes: 3 additions & 11 deletions assets/newspack-ui/scss/elements/forms/_labels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,15 @@
}
}

// 'Selected' label
&:has( .newspack_ui__input-card__selected ) {
// 'Selected' badge
&:has( .newspack_ui__badge ) {
grid-template-columns: var( --newspack-ui-spacer-4 ) 1fr min-content;
}

.newspack_ui__input-card__selected {
.newspack_ui__badge {
align-self: start;
background: var( --newspack-ui-color-neutral-90 );
border-radius: var( --newspack-ui-border-radius-xs );
color: var( --newspack-ui-color-neutral-0 );
font-size: var( --newspack-ui-font-size-xs );
font-weight: 600;
grid-column-start: 3;
grid-row-start: 1;
line-height: var( --newspack-ui-line-height-xs );
padding: 2px 6px; // TODO: replace with variables; they only go down to 8px, rethink?
text-transform: uppercase;
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions assets/newspack-ui/scss/elements/misc/_badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.newspack_ui__badge {
background: var( --newspack-ui-color-neutral-90 );
border-radius: var( --newspack-ui-border-radius-xs );
color: var( --newspack-ui-color-neutral-0 );
display: inline-grid;
font-size: var( --newspack-ui-font-size-xs );
font-weight: 600;
line-height: var( --newspack-ui-line-height-xs );
padding: 2px 6px; // TODO: replace with variables; they only go down to 8px, perhaps they need to be rethought?
place-items: center;
text-transform: uppercase;
}
3 changes: 2 additions & 1 deletion assets/newspack-ui/scss/elements/misc/_index.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@use 'word-divider';
@use 'word-divider';
@use 'badge';
8 changes: 7 additions & 1 deletion includes/class-newspack-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static function return_demo_content() {
<label class="newspack-ui__input-card">
<input type="radio" name="list-radio-option" checked>
<strong>The Weekly</strong><br>
<span class="newspack_ui__input-card__selected">Current</span>
<span class="newspack_ui__badge">Badge</span>
<span class="newspack-ui__helper-text">Friday roundup of the most relevant stories.</span>
</label>

Expand Down Expand Up @@ -311,6 +311,12 @@ public static function return_demo_content() {
</table>
</div>

<hr>

<h2 id="badges">Badges (more examples TK)</h2>
<span class="newspack_ui__badge">Badge</span><br>


<hr>

<h2 id="buttons">Buttons</h2>
Expand Down

0 comments on commit 41a60ea

Please sign in to comment.