diff --git a/themes/wporg-5ftf/css/components/_components.scss b/themes/wporg-5ftf/css/components/_components.scss index fc941d2..118e8d3 100644 --- a/themes/wporg-5ftf/css/components/_components.scss +++ b/themes/wporg-5ftf/css/components/_components.scss @@ -25,4 +25,5 @@ @import "site-content"; @import "site-header"; @import "site-title"; +@import "team-badges"; @import "wporg-header"; diff --git a/themes/wporg-5ftf/css/components/_team-badges.scss b/themes/wporg-5ftf/css/components/_team-badges.scss new file mode 100644 index 0000000..01850a2 --- /dev/null +++ b/themes/wporg-5ftf/css/components/_team-badges.scss @@ -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 +} diff --git a/themes/wporg-5ftf/functions.php b/themes/wporg-5ftf/functions.php index 29c52e1..1beb795 100644 --- a/themes/wporg-5ftf/functions.php +++ b/themes/wporg-5ftf/functions.php @@ -204,3 +204,98 @@ function loader_src( $src, $handle ) { } add_filter( 'style_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; +} diff --git a/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php b/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php index e9a5dd0..8bd38a0 100644 --- a/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php +++ b/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php @@ -58,9 +58,11 @@ $contributors = Contributor\get_contributor_user_objects( ?>