mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-03 01:31:17 +03:00
Theme: Add functions, markup, and styles to show team badges
This commit is contained in:
parent
24d5f67040
commit
886dca56de
|
@ -25,4 +25,5 @@
|
||||||
@import "site-content";
|
@import "site-content";
|
||||||
@import "site-header";
|
@import "site-header";
|
||||||
@import "site-title";
|
@import "site-title";
|
||||||
|
@import "team-badges";
|
||||||
@import "wporg-header";
|
@import "wporg-header";
|
||||||
|
|
170
themes/wporg-5ftf/css/components/_team-badges.scss
Normal file
170
themes/wporg-5ftf/css/components/_team-badges.scss
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
/**
|
||||||
|
* Copied from the profiles.wordpress.org theme stylesheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.team-grid div.dashicons:before {
|
||||||
|
position: relative;
|
||||||
|
top: 2px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
margin: 4px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
//position: absolute;
|
||||||
|
//top: 8px;
|
||||||
|
//left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-themes-reviewer {
|
||||||
|
background: rgba(78, 50, 136, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(78, 50, 136);
|
||||||
|
}
|
||||||
|
.badge-themes-reviewer:before {
|
||||||
|
color: rgb(78, 50, 136);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-plugins-reviewer {
|
||||||
|
background: rgba(240, 103, 35, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(240, 103, 35);
|
||||||
|
}
|
||||||
|
.badge-plugins-reviewer:before {
|
||||||
|
color: rgb(240, 103, 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-community {
|
||||||
|
background: rgba(17, 121, 157, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(17, 121, 157);
|
||||||
|
}
|
||||||
|
.badge-community:before {
|
||||||
|
color: rgb(17, 121, 157);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-meta {
|
||||||
|
background: rgba(174, 173, 173, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(174, 173, 173);
|
||||||
|
}
|
||||||
|
.badge-meta:before {
|
||||||
|
color: rgb(174, 173, 173);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-code-committer {
|
||||||
|
background: rgba(205, 0, 0, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(205, 0, 0);
|
||||||
|
}
|
||||||
|
.badge-code-committer:before {
|
||||||
|
color: rgb(205, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-support {
|
||||||
|
background: rgba(51, 180, 206, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(51, 180, 206);
|
||||||
|
}
|
||||||
|
.badge-support:before {
|
||||||
|
color: rgb(51, 180, 206);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-wordpress-tv {
|
||||||
|
background: rgba(115, 173, 48, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(115, 173, 48);
|
||||||
|
}
|
||||||
|
.badge-wordpress-tv:before {
|
||||||
|
color: rgb(115, 173, 48);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-accessibility {
|
||||||
|
background: rgba(17, 121, 157, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(17, 121, 157);
|
||||||
|
}
|
||||||
|
.badge-accessibility:before {
|
||||||
|
color: rgb(17, 121, 157);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-documentation {
|
||||||
|
background: rgba(59, 114, 54, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(59, 114, 54);
|
||||||
|
}
|
||||||
|
.badge-documentation:before {
|
||||||
|
color: rgb(59, 114, 54);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-mobile {
|
||||||
|
background: rgba(251, 161, 108, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(251, 161, 108);
|
||||||
|
}
|
||||||
|
.badge-mobile:before {
|
||||||
|
color: rgb(251, 161, 108);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-training{
|
||||||
|
background: rgba(233, 192, 45, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(233, 192, 45);
|
||||||
|
}
|
||||||
|
.badge-training:before {
|
||||||
|
color: rgb(233, 192, 45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-translation-editor {
|
||||||
|
background: rgba(195, 34, 131, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(195, 34, 131);
|
||||||
|
}
|
||||||
|
.badge-translation-editor:before {
|
||||||
|
color: rgb(195, 34, 131);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-design {
|
||||||
|
background: rgba(238, 194, 106, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(238, 194, 106);
|
||||||
|
}
|
||||||
|
.badge-design:before {
|
||||||
|
color: rgb(238, 194, 106);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-marketing {
|
||||||
|
background: rgba(71, 190, 167, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(71, 190, 167);
|
||||||
|
}
|
||||||
|
.badge-marketing:before {
|
||||||
|
color: rgb(71, 190, 167);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-wp-cli {
|
||||||
|
background: rgba(66, 66, 66, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(66, 66, 66);
|
||||||
|
}
|
||||||
|
.badge-wp-cli:before {
|
||||||
|
color: rgb(66, 66, 66);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-hosting {
|
||||||
|
background: rgba(83, 88, 166, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(83, 88, 166);
|
||||||
|
}
|
||||||
|
.badge-hosting:before {
|
||||||
|
color: rgb(83, 88, 166);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-tide {
|
||||||
|
background: rgb(197, 201, 255);
|
||||||
|
box-shadow: 0 0 0 4px rgb(21, 38, 255);
|
||||||
|
}
|
||||||
|
.badge-tide:before {
|
||||||
|
color: rgb(21, 38, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-security-team {
|
||||||
|
background: rgba(0, 204, 58, 0.25);
|
||||||
|
box-shadow: 0 0 0 4px rgb(0, 204, 58);
|
||||||
|
}
|
||||||
|
.badge-security-team:before {
|
||||||
|
color: rgb(0, 204, 58);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-test {
|
||||||
|
// TODO
|
||||||
|
}
|
|
@ -204,3 +204,98 @@ function loader_src( $src, $handle ) {
|
||||||
}
|
}
|
||||||
add_filter( 'style_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
|
add_filter( 'style_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
|
||||||
add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
|
add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the CSS classes for a given team badge.
|
||||||
|
*
|
||||||
|
* Based on the `wporg_profiles_get_association_classes` function in the profiles.wordpress.org theme.
|
||||||
|
*
|
||||||
|
* @param string $team
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function get_badge_classes( $team ) {
|
||||||
|
switch( strtolower( $team ) ) {
|
||||||
|
case 'accessibility':
|
||||||
|
$classes = array( 'badge-accessibility', 'dashicons-universal-access' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'cli':
|
||||||
|
$classes = array( 'badge-wp-cli', 'dashicons-arrow-right-alt2' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'community':
|
||||||
|
$classes = array( 'badge-community', 'dashicons-groups' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'core':
|
||||||
|
$classes = array( 'badge-code-committer', 'dashicons-editor-code' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'design':
|
||||||
|
$classes = array( 'badge-design', 'dashicons-art' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'documentation':
|
||||||
|
$classes = array( 'badge-documentation', 'dashicons-admin-page' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'hosting':
|
||||||
|
$classes = array( 'badge-hosting', 'dashicons-cloud' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'marketing':
|
||||||
|
$classes = array( 'badge-marketing', 'dashicons-format-status' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'meta':
|
||||||
|
$classes = array( 'badge-meta', 'dashicons-networking' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'mobile':
|
||||||
|
$classes = array( 'badge-mobile', 'dashicons-smartphone' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'plugins':
|
||||||
|
$classes = array( 'badge-plugins-reviewer ', 'dashicons-admin-plugins' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'polyglots':
|
||||||
|
$classes = array( 'badge-translation-editor', 'dashicons-translation' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'security':
|
||||||
|
$classes = array( 'badge-security-team', 'dashicons-lock' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'support':
|
||||||
|
$classes = array( 'badge-support', 'dashicons-format-chat' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'test':
|
||||||
|
$classes = array( 'badge-test' ); // TODO
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'themes':
|
||||||
|
$classes = array( 'badge-themes-reviewer', 'dashicons-admin-appearance' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'tide':
|
||||||
|
$classes = array( 'badge-tide', 'dashicons-tide' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'training':
|
||||||
|
$classes = array( 'badge-training', 'dashicons-welcome-learn-more' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'tv':
|
||||||
|
$classes = array( 'badge-wordpress-tv', 'dashicons-video-alt2' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$classes = array();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
|
|
@ -58,9 +58,11 @@ $contributors = Contributor\get_contributor_user_objects(
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<ul class="team-grid">
|
<ul class="team-grid">
|
||||||
<?php foreach ( $contribution_data['teams'] as $team ) : ?>
|
<?php foreach ( $contribution_data['teams'] as $team ) :
|
||||||
|
$badge_classes = get_badge_classes( $team );
|
||||||
|
?>
|
||||||
<li>
|
<li>
|
||||||
<span class="team-badge team-<?php echo esc_attr( strtolower( $team ) ); ?>"></span>
|
<div class="badge item dashicons <?php echo esc_attr( implode( ' ', $badge_classes ) ); ?>"></div>
|
||||||
<?php echo esc_html( $team ); ?>
|
<?php echo esc_html( $team ); ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
Loading…
Reference in a new issue