mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Add setBackground to PHUIIconView
Summary: Ref T11132. Adds a background color option to PHUIIconView, for use whereever, and NUX. Also normalize icon placement for mixed image/icon result list. Test Plan: Test in UIExamples, and Global Settings. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11132 Differential Revision: https://secure.phabricator.com/D16424
This commit is contained in:
parent
3bd0da0ec2
commit
f379858874
7 changed files with 108 additions and 35 deletions
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => 'ba6d7e7a',
|
'core.pkg.css' => 'ed7ae7bb',
|
||||||
'core.pkg.js' => 'b562c3db',
|
'core.pkg.js' => 'b562c3db',
|
||||||
'darkconsole.pkg.js' => 'e7393ebb',
|
'darkconsole.pkg.js' => 'e7393ebb',
|
||||||
'differential.pkg.css' => '3fb7f532',
|
'differential.pkg.css' => '3fb7f532',
|
||||||
|
@ -112,7 +112,7 @@ return array(
|
||||||
'rsrc/css/font/font-aleo.css' => '8bdb2835',
|
'rsrc/css/font/font-aleo.css' => '8bdb2835',
|
||||||
'rsrc/css/font/font-awesome.css' => '2b7ebbcc',
|
'rsrc/css/font/font-awesome.css' => '2b7ebbcc',
|
||||||
'rsrc/css/font/font-lato.css' => 'c7ccd872',
|
'rsrc/css/font/font-lato.css' => 'c7ccd872',
|
||||||
'rsrc/css/font/phui-font-icon-base.css' => '6449bce8',
|
'rsrc/css/font/phui-font-icon-base.css' => '4e8274c4',
|
||||||
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
|
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
|
||||||
'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983',
|
'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983',
|
||||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893',
|
'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893',
|
||||||
|
@ -141,13 +141,13 @@ return array(
|
||||||
'rsrc/css/phui/phui-header-view.css' => '06385974',
|
'rsrc/css/phui/phui-header-view.css' => '06385974',
|
||||||
'rsrc/css/phui/phui-hovercard.css' => 'de1a2119',
|
'rsrc/css/phui/phui-hovercard.css' => 'de1a2119',
|
||||||
'rsrc/css/phui/phui-icon-set-selector.css' => '1ab67aad',
|
'rsrc/css/phui/phui-icon-set-selector.css' => '1ab67aad',
|
||||||
'rsrc/css/phui/phui-icon.css' => 'd0534b71',
|
'rsrc/css/phui/phui-icon.css' => 'b1dbd620',
|
||||||
'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c',
|
'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c',
|
||||||
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
||||||
'rsrc/css/phui/phui-info-view.css' => '28efab79',
|
'rsrc/css/phui/phui-info-view.css' => '28efab79',
|
||||||
'rsrc/css/phui/phui-list.css' => '9da2aa00',
|
'rsrc/css/phui/phui-list.css' => '9da2aa00',
|
||||||
'rsrc/css/phui/phui-object-box.css' => '6b487c57',
|
'rsrc/css/phui/phui-object-box.css' => '6b487c57',
|
||||||
'rsrc/css/phui/phui-object-item-list-view.css' => 'aefe157c',
|
'rsrc/css/phui/phui-object-item-list-view.css' => '40010767',
|
||||||
'rsrc/css/phui/phui-pager.css' => 'bea33d23',
|
'rsrc/css/phui/phui-pager.css' => 'bea33d23',
|
||||||
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
|
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
|
||||||
'rsrc/css/phui/phui-profile-menu.css' => '8a3fc181',
|
'rsrc/css/phui/phui-profile-menu.css' => '8a3fc181',
|
||||||
|
@ -840,7 +840,7 @@ return array(
|
||||||
'phui-document-view-css' => 'c32e8dec',
|
'phui-document-view-css' => 'c32e8dec',
|
||||||
'phui-document-view-pro-css' => 'dc3d46ed',
|
'phui-document-view-pro-css' => 'dc3d46ed',
|
||||||
'phui-feed-story-css' => 'aa49845d',
|
'phui-feed-story-css' => 'aa49845d',
|
||||||
'phui-font-icon-base-css' => '6449bce8',
|
'phui-font-icon-base-css' => '4e8274c4',
|
||||||
'phui-fontkit-css' => '9cda225e',
|
'phui-fontkit-css' => '9cda225e',
|
||||||
'phui-form-css' => 'aac1d51d',
|
'phui-form-css' => 'aac1d51d',
|
||||||
'phui-form-view-css' => '76b4a46c',
|
'phui-form-view-css' => '76b4a46c',
|
||||||
|
@ -849,14 +849,14 @@ return array(
|
||||||
'phui-hovercard' => '1bd28176',
|
'phui-hovercard' => '1bd28176',
|
||||||
'phui-hovercard-view-css' => 'de1a2119',
|
'phui-hovercard-view-css' => 'de1a2119',
|
||||||
'phui-icon-set-selector-css' => '1ab67aad',
|
'phui-icon-set-selector-css' => '1ab67aad',
|
||||||
'phui-icon-view-css' => 'd0534b71',
|
'phui-icon-view-css' => 'b1dbd620',
|
||||||
'phui-image-mask-css' => 'a8498f9c',
|
'phui-image-mask-css' => 'a8498f9c',
|
||||||
'phui-info-panel-css' => '27ea50a1',
|
'phui-info-panel-css' => '27ea50a1',
|
||||||
'phui-info-view-css' => '28efab79',
|
'phui-info-view-css' => '28efab79',
|
||||||
'phui-inline-comment-view-css' => '5953c28e',
|
'phui-inline-comment-view-css' => '5953c28e',
|
||||||
'phui-list-view-css' => '9da2aa00',
|
'phui-list-view-css' => '9da2aa00',
|
||||||
'phui-object-box-css' => '6b487c57',
|
'phui-object-box-css' => '6b487c57',
|
||||||
'phui-object-item-list-view-css' => 'aefe157c',
|
'phui-object-item-list-view-css' => '40010767',
|
||||||
'phui-pager-css' => 'bea33d23',
|
'phui-pager-css' => 'bea33d23',
|
||||||
'phui-pinboard-view-css' => '2495140e',
|
'phui-pinboard-view-css' => '2495140e',
|
||||||
'phui-profile-menu-css' => '8a3fc181',
|
'phui-profile-menu-css' => '8a3fc181',
|
||||||
|
|
|
@ -62,11 +62,14 @@ final class PhabricatorUserPreferencesSearchEngine
|
||||||
->setViewer($viewer);
|
->setViewer($viewer);
|
||||||
foreach ($settings as $setting) {
|
foreach ($settings as $setting) {
|
||||||
|
|
||||||
|
$icon = id(new PHUIIconView())
|
||||||
|
->setIcon('fa-globe')
|
||||||
|
->setBackground('bg-sky');
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new PHUIObjectItemView())
|
||||||
->setHeader($setting->getDisplayName())
|
->setHeader($setting->getDisplayName())
|
||||||
->setHref($setting->getEditURI())
|
->setHref($setting->getEditURI())
|
||||||
// TODO: Replace this with NUX Style bg / white icon when built
|
->setImageIcon($icon)
|
||||||
->setImageIcon('fa-globe')
|
|
||||||
->addAttribute(pht('Edit global default settings for all users.'));
|
->addAttribute(pht('Edit global default settings for all users.'));
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
|
|
|
@ -130,6 +130,17 @@ final class PHUIIconExample extends PhabricatorUIExample {
|
||||||
->addClass('mmr');
|
->addClass('mmr');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$squares = array('fa-briefcase', 'fa-code', 'fa-globe', 'fa-home');
|
||||||
|
$squareview = array();
|
||||||
|
foreach ($squares as $icon) {
|
||||||
|
$squareview[] =
|
||||||
|
id(new PHUIIconView())
|
||||||
|
->setIcon($icon)
|
||||||
|
->setBackground('bg-blue')
|
||||||
|
->setHref('#')
|
||||||
|
->addClass('mmr');
|
||||||
|
}
|
||||||
|
|
||||||
$layout_cicons = id(new PHUIBoxView())
|
$layout_cicons = id(new PHUIBoxView())
|
||||||
->appendChild($cicons)
|
->appendChild($cicons)
|
||||||
->addMargin(PHUI::MARGIN_LARGE);
|
->addMargin(PHUI::MARGIN_LARGE);
|
||||||
|
@ -155,6 +166,10 @@ final class PHUIIconExample extends PhabricatorUIExample {
|
||||||
->addMargin(PHUI::MARGIN_MEDIUM);
|
->addMargin(PHUI::MARGIN_MEDIUM);
|
||||||
|
|
||||||
$layout5 = id(new PHUIBoxView())
|
$layout5 = id(new PHUIBoxView())
|
||||||
|
->appendChild($squareview)
|
||||||
|
->addMargin(PHUI::MARGIN_MEDIUM);
|
||||||
|
|
||||||
|
$layout6 = id(new PHUIBoxView())
|
||||||
->appendChild($loginview)
|
->appendChild($loginview)
|
||||||
->addMargin(PHUI::MARGIN_MEDIUM);
|
->addMargin(PHUI::MARGIN_MEDIUM);
|
||||||
|
|
||||||
|
@ -187,9 +202,13 @@ final class PHUIIconExample extends PhabricatorUIExample {
|
||||||
->appendChild($layout4);
|
->appendChild($layout4);
|
||||||
|
|
||||||
$wrap5 = id(new PHUIObjectBoxView())
|
$wrap5 = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText(pht('Authentication'))
|
->setHeaderText(pht('Squares'))
|
||||||
->appendChild($layout5);
|
->appendChild($layout5);
|
||||||
|
|
||||||
|
$wrap6 = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Authentication'))
|
||||||
|
->appendChild($layout6);
|
||||||
|
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
|
@ -202,6 +221,7 @@ final class PHUIIconExample extends PhabricatorUIExample {
|
||||||
$wrap3,
|
$wrap3,
|
||||||
$wrap4,
|
$wrap4,
|
||||||
$wrap5,
|
$wrap5,
|
||||||
|
$wrap6,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
private $spriteSheet;
|
private $spriteSheet;
|
||||||
private $iconFont;
|
private $iconFont;
|
||||||
private $iconColor;
|
private $iconColor;
|
||||||
|
private $iconBackground;
|
||||||
|
|
||||||
public function setHref($href) {
|
public function setHref($href) {
|
||||||
$this->href = $href;
|
$this->href = $href;
|
||||||
|
@ -54,6 +55,11 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setBackground($color) {
|
||||||
|
$this->iconBackground = $color;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getTagName() {
|
protected function getTagName() {
|
||||||
$tag = 'span';
|
$tag = 'span';
|
||||||
if ($this->href) {
|
if ($this->href) {
|
||||||
|
@ -79,6 +85,10 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
if ($this->iconColor) {
|
if ($this->iconColor) {
|
||||||
$classes[] = $this->iconColor;
|
$classes[] = $this->iconColor;
|
||||||
}
|
}
|
||||||
|
if ($this->iconBackground) {
|
||||||
|
$classes[] = 'phui-icon-square';
|
||||||
|
$classes[] = $this->iconBackground;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->headSize) {
|
if ($this->headSize) {
|
||||||
$classes[] = $this->headSize;
|
$classes[] = $this->headSize;
|
||||||
|
|
|
@ -151,6 +151,45 @@
|
||||||
color: rgba({$alphagrey},0.3);
|
color: rgba({$alphagrey},0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Backgrounds */
|
||||||
|
|
||||||
|
.phui-icon-view.bg-dark {
|
||||||
|
background-color: {$darkgreytext};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-bluegrey {
|
||||||
|
background-color: {$bluetext};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-red {
|
||||||
|
background-color: {$red};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-orange {
|
||||||
|
background-color: {$orange};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-yellow {
|
||||||
|
background-color: {$yellow};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-green {
|
||||||
|
background-color: {$green}
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-blue {
|
||||||
|
background-color: {$blue};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-sky {
|
||||||
|
background-color: {$sky};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-indigo {
|
||||||
|
background-color: {$indigo};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-pink {
|
||||||
|
background-color: {$pink};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-fire {
|
||||||
|
background-color: {$fire};
|
||||||
|
}
|
||||||
|
.phui-icon-view.bg-violet {
|
||||||
|
background-color: {$violet};
|
||||||
|
}
|
||||||
|
|
||||||
/* Hovers */
|
/* Hovers */
|
||||||
|
|
||||||
.device-desktop a.phui-icon-view.lightgreytext:hover,
|
.device-desktop a.phui-icon-view.lightgreytext:hover,
|
||||||
|
|
|
@ -80,3 +80,20 @@ a.phui-icon-circle:hover {
|
||||||
a.phui-icon-circle:hover .phui-icon-view {
|
a.phui-icon-circle:hover .phui-icon-view {
|
||||||
color: {$sky};
|
color: {$sky};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* - Icon in a Square ------------------------------------------------------- */
|
||||||
|
|
||||||
|
.phui-icon-view.phui-icon-square {
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 26px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 38px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.phui-icon-view.phui-icon-square:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
|
@ -651,37 +651,19 @@ ul.phui-object-item-list-view .phui-object-item-selected
|
||||||
|
|
||||||
.phui-object-item-image-icon {
|
.phui-object-item-image-icon {
|
||||||
background: none;
|
background: none;
|
||||||
width: 30px;
|
width: 40px;
|
||||||
height: 30px;
|
height: 40px;
|
||||||
margin: 4px 0;
|
margin: 8px 6px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-object-item-image-icon .phui-icon-view {
|
.phui-object-item-image-icon .phui-icon-view {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 24px;
|
width: 40px;
|
||||||
height: 24px;
|
height: 40px;
|
||||||
left: 6px;
|
font-size: 26px;
|
||||||
top: 10px;
|
|
||||||
font-size: 24px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: bottom;
|
line-height: 36px;
|
||||||
}
|
|
||||||
|
|
||||||
.phui-object-item-with-image-icon .phui-object-item-frame {
|
|
||||||
min-height: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.phui-object-item-with-image-icon .phui-object-item-content-box {
|
|
||||||
margin-left: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-desktop .phui-object-item-launcher-list .phui-object-item-content {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-desktop .phui-object-item-launcher-list .phui-object-icon-pane {
|
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-object-item-image {
|
.phui-object-item-image {
|
||||||
|
@ -693,10 +675,12 @@ ul.phui-object-item-list-view .phui-object-item-selected
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phui-object-item-with-image-icon .phui-object-item-frame,
|
||||||
.phui-object-item-with-image .phui-object-item-frame {
|
.phui-object-item-with-image .phui-object-item-frame {
|
||||||
min-height: 52px;
|
min-height: 52px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phui-object-item-with-image-icon .phui-object-item-content-box,
|
||||||
.phui-object-item-with-image .phui-object-item-content-box {
|
.phui-object-item-with-image .phui-object-item-content-box {
|
||||||
margin-left: 46px;
|
margin-left: 46px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue