Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions includes/class-newspack-ui-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ public static function sanitize_svgs() {
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--key">
<path d="M10.4984 9.5C10.4984 7.29063 12.289 5.5 14.4984 5.5C16.7078 5.5 18.4984 7.29063 18.4984 9.5C18.4984 11.7094 16.7078 13.5 14.4984 13.5C14.1734 13.5 13.8578 13.4625 13.5578 13.3875C13.3047 13.325 13.0359 13.4 12.8515 13.5875L11.939 14.5H10.2484C9.83279 14.5 9.49841 14.8344 9.49841 15.25V16.5H8.24841C7.83279 16.5 7.49841 16.8344 7.49841 17.25V18.5H5.49841V16.0594L10.4109 11.1469C10.5953 10.9625 10.6703 10.6938 10.6109 10.4406C10.539 10.1406 10.4984 9.825 10.4984 9.5ZM14.4984 4C11.4609 4 8.99841 6.4625 8.99841 9.5C8.99841 9.79688 9.02029 10.0875 9.06716 10.3719L4.21716 15.2188C4.07654 15.3594 3.99841 15.55 3.99841 15.75V19.25C3.99841 19.6656 4.33279 20 4.74841 20H8.24841C8.66404 20 8.99841 19.6656 8.99841 19.25V18H10.2484C10.664 18 10.9984 17.6656 10.9984 17.25V16H12.2484C12.4484 16 12.639 15.9219 12.7797 15.7812L13.6297 14.9312C13.914 14.975 14.2047 15 14.5015 15C17.539 15 20.0015 12.5375 20.0015 9.5C20.0015 6.4625 17.5359 4 14.4984 4ZM15.4984 9.5C15.7636 9.5 16.018 9.39464 16.2055 9.20711C16.3931 9.01957 16.4984 8.76522 16.4984 8.5C16.4984 8.23478 16.3931 7.98043 16.2055 7.79289C16.018 7.60536 15.7636 7.5 15.4984 7.5C15.2332 7.5 14.9788 7.60536 14.7913 7.79289C14.6038 7.98043 14.4984 8.23478 14.4984 8.5C14.4984 8.76522 14.6038 9.01957 14.7913 9.20711C14.9788 9.39464 15.2332 9.5 15.4984 9.5Z" />
</svg>',
'lineSolid' =>
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--line-solid">
<path d="M5 11.25h14v1.5H5z" />
</svg>',
'login' =>
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--login">
<path d="M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z" />
Expand Down
54 changes: 52 additions & 2 deletions includes/class-newspack-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ public static function generate_modal( $args ) {
?>
<?php if ( isset( $action['url'] ) ) : ?>
<a href="<?php echo esc_url( $action['url'] ); ?>" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" <?php echo esc_attr( $fetch_data ); ?>>
<?php echo wp_kses_post( $action['label'] ); ?>
<span><?php echo wp_kses_post( $action['label'] ); ?></span>
</a>
<?php else : ?>
<button type="submit" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" <?php echo esc_attr( $fetch_data ); ?>>
<?php echo wp_kses_post( $action['label'] ); ?>
<span><?php echo wp_kses_post( $action['label'] ); ?></span>
</button>
<?php
endif;
Expand Down Expand Up @@ -356,6 +356,7 @@ public static function return_demo_content() {
<li><a href="?ui-demo#checkbox-radio-lists">Checkbox/Radio Lists</a></li>
<li><a href="?ui-demo#order-table">Order table</a></li>
<li><a href="?ui-demo#buttons">Buttons</a></li>
<li><a href="?ui-demo#tabs">Tabs</a></li>
<li><a href="#buttons-icon">Buttons Icon</a></li>
<li><a href="?ui-demo#modals">Modals</a></li>
</ul>
Expand Down Expand Up @@ -896,6 +897,55 @@ public static function return_demo_content() {

<hr>

<h2 id="tabs">Tabs</h2>
<p>Underline-style tabs. Built on Ghost button + bottom box-shadow. Drop-in replacement for <code>newspack-ui__segmented-control</code> where the underline aesthetic is preferred.</p>

<h3>Default</h3>
<div class="newspack-ui__tabs">
<div class="newspack-ui__tabs__list" role="tablist">
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost selected"><?php esc_html_e( 'Tab One', 'newspack-plugin' ); ?></button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost"><?php esc_html_e( 'Tab Two', 'newspack-plugin' ); ?></button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost"><?php esc_html_e( 'Tab Three', 'newspack-plugin' ); ?></button>
</div>
</div>

<h3>With count badges</h3>
<div class="newspack-ui__tabs">
<div class="newspack-ui__tabs__list" role="tablist">
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost selected">
<?php esc_html_e( 'Members', 'newspack-plugin' ); ?>
<span class="newspack-ui__badge newspack-ui__badge--outline">12</span>
</button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost">
<?php esc_html_e( 'Invitations', 'newspack-plugin' ); ?>
<span class="newspack-ui__badge newspack-ui__badge--outline">3</span>
</button>
</div>
</div>

<h3>Small &mdash; with panels</h3>
<div class="newspack-ui__tabs">
<div class="newspack-ui__tabs__list" role="tablist">
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost newspack-ui__button--small selected"><?php esc_html_e( 'Monthly', 'newspack-plugin' ); ?></button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost newspack-ui__button--small"><?php esc_html_e( 'Annually', 'newspack-plugin' ); ?></button>
</div>
<div class="newspack-ui__tabs__content">
<div class="newspack-ui__tabs__panel"><p><?php esc_html_e( 'Monthly content goes here.', 'newspack-plugin' ); ?></p></div>
<div class="newspack-ui__tabs__panel"><p><?php esc_html_e( 'Annually content goes here.', 'newspack-plugin' ); ?></p></div>
</div>
</div>

<h3>X-Small &mdash; stretch (equal width)</h3>
<div class="newspack-ui__tabs newspack-ui__tabs--stretch">
<div class="newspack-ui__tabs__list" role="tablist">
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost newspack-ui__button--x-small selected"><?php esc_html_e( 'All', 'newspack-plugin' ); ?></button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost newspack-ui__button--x-small"><?php esc_html_e( 'Active', 'newspack-plugin' ); ?></button>
<button type="button" role="tab" class="newspack-ui__button newspack-ui__button--ghost newspack-ui__button--x-small"><?php esc_html_e( 'Archived', 'newspack-plugin' ); ?></button>
</div>
</div>

<hr>

<h2 id="buttons-icon">Buttons Icon</h2>

<p>Uses the same classes as the <code>newspack-ui__button</code> but we add an extra class to it <code>newspack-ui__button--icon</code></p>
Expand Down
Loading
Loading