From e096a227db1defab57dc664d88be1eeead6e40a9 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 26 Jun 2014 14:19:32 -0700 Subject: [PATCH] Slimmer Shade Tags Summary: Shaves a pixel for use in ObjectLists. Test Plan: UIExamples. {F170655} Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9746 --- resources/celerity/map.php | 6 +++--- .../uiexample/examples/PHUITagExample.php | 8 ++++++++ src/view/phui/PHUITagView.php | 10 +++++++++- webroot/rsrc/css/phui/phui-tag-view.css | 11 +++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index d3929d1840..772128b6d3 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ return array( 'names' => array( - 'core.pkg.css' => 'b2a7a97c', + 'core.pkg.css' => 'c494bff8', 'core.pkg.js' => '834b4eda', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '4a93db37', @@ -141,7 +141,7 @@ return array( 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', 'rsrc/css/phui/phui-spacing.css' => '042804d6', 'rsrc/css/phui/phui-status.css' => '2f562399', - 'rsrc/css/phui/phui-tag-view.css' => '4f920464', + 'rsrc/css/phui/phui-tag-view.css' => '30dd4e6f', 'rsrc/css/phui/phui-text.css' => '23e9b4b7', 'rsrc/css/phui/phui-timeline-view.css' => 'bbd990d0', 'rsrc/css/phui/phui-workboard-view.css' => '2bf82d00', @@ -787,7 +787,7 @@ return array( 'phui-remarkup-preview-css' => '19ad512b', 'phui-spacing-css' => '042804d6', 'phui-status-list-view-css' => '2f562399', - 'phui-tag-view-css' => '4f920464', + 'phui-tag-view-css' => '30dd4e6f', 'phui-text-css' => '23e9b4b7', 'phui-timeline-view-css' => 'bbd990d0', 'phui-workboard-view-css' => '2bf82d00', diff --git a/src/applications/uiexample/examples/PHUITagExample.php b/src/applications/uiexample/examples/PHUITagExample.php index ce0fcadf1a..8b96480075 100644 --- a/src/applications/uiexample/examples/PHUITagExample.php +++ b/src/applications/uiexample/examples/PHUITagExample.php @@ -165,6 +165,14 @@ final class PHUITagExample extends PhabricatorUIExample { ->setIcon('fa-tags') ->setName(ucwords($shade)) ->setHref('#'); + $tags[] = hsprintf(' '); + $tags[] = id(new PHUITagView()) + ->setType(PHUITagView::TYPE_OBJECT) + ->setShade($shade) + ->setSlimShady(true) + ->setIcon('fa-tags') + ->setName(ucwords($shade)) + ->setHref('#'); $tags[] = hsprintf('

'); } diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php index 2e504ed031..1e2e86577c 100644 --- a/src/view/phui/PHUITagView.php +++ b/src/view/phui/PHUITagView.php @@ -34,6 +34,7 @@ final class PHUITagView extends AphrontTagView { private $external; private $icon; private $shade; + private $slimShady; public function setType($type) { $this->type = $type; @@ -90,6 +91,11 @@ final class PHUITagView extends AphrontTagView { return $this; } + public function setSlimShady($mm) { + $this->slimShady = $mm; + return $this; + } + protected function getTagName() { return strlen($this->href) ? 'a' : 'span'; } @@ -105,9 +111,11 @@ final class PHUITagView extends AphrontTagView { if ($this->shade) { $classes[] = 'phui-tag-shade'; $classes[] = 'phui-tag-shade-'.$this->shade; + if ($this->slimShady) { + $classes[] = 'phui-tag-shade-slim'; + } } - if ($this->icon) { $classes[] = 'phui-tag-icon-view'; } diff --git a/webroot/rsrc/css/phui/phui-tag-view.css b/webroot/rsrc/css/phui/phui-tag-view.css index 589af1ffff..1105453e0b 100644 --- a/webroot/rsrc/css/phui/phui-tag-view.css +++ b/webroot/rsrc/css/phui/phui-tag-view.css @@ -158,6 +158,17 @@ a.phui-tag-view:hover left: 6px; } +.phui-tag-shade-slim .phui-icon-view { + font-size: 11px; + top: 3px; + left: 6px; +} + +.phui-tag-shade-slim.phui-tag-icon-view .phui-tag-core { + padding-left: 20px; + font-size: 12px; +} + .phui-tag-shade-red .phui-tag-core { background-color: {$sh-redbackground}; border-color: {$sh-lightredborder};