Changeset View
Changeset View
Standalone View
Standalone View
src/applications/uiexample/examples/PHUIButtonExample.php
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | foreach ($icons as $text => $icon) { | ||||
| $column[] = id(new PHUIButtonView()) | $column[] = id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setColor(PHUIButtonView::GREY) | ->setColor(PHUIButtonView::GREY) | ||||
| ->setIcon($image) | ->setIcon($image) | ||||
| ->setText($text) | ->setText($text) | ||||
| ->addClass(PHUI::MARGIN_SMALL_RIGHT); | ->addClass(PHUI::MARGIN_SMALL_RIGHT); | ||||
| } | } | ||||
| $column2 = array(); | $layout3 = id(new AphrontMultiColumnView()) | ||||
| ->addColumn($column) | |||||
| ->setFluidLayout(true) | |||||
| ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); | |||||
| $icons = array( | $icons = array( | ||||
| 'Subscribe' => 'fa-check-circle bluegrey', | 'Subscribe' => 'fa-check-circle bluegrey', | ||||
| 'Edit' => 'fa-pencil bluegrey', | 'Edit' => 'fa-pencil bluegrey', | ||||
| ); | ); | ||||
| $colors = array( | |||||
| PHUIButtonView::SIMPLE, | |||||
| PHUIButtonView::SIMPLE_YELLOW, | |||||
| PHUIButtonView::SIMPLE_GREY, | |||||
| PHUIButtonView::SIMPLE_BLUE, | |||||
| ); | |||||
| $column = array(); | |||||
| foreach ($colors as $color) { | |||||
| foreach ($icons as $text => $icon) { | foreach ($icons as $text => $icon) { | ||||
| $image = id(new PHUIIconView()) | $image = id(new PHUIIconView()) | ||||
| ->setIconFont($icon); | ->setIconFont($icon); | ||||
| $column2[] = id(new PHUIButtonView()) | $column[] = id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setColor(PHUIButtonView::SIMPLE) | ->setColor($color) | ||||
| ->setIcon($image) | ->setIcon($image) | ||||
| ->setText($text) | ->setText($text) | ||||
| ->addClass(PHUI::MARGIN_SMALL_RIGHT); | ->addClass(PHUI::MARGIN_SMALL_RIGHT); | ||||
| } | } | ||||
| } | |||||
| $layout3 = id(new AphrontMultiColumnView()) | $layout4 = id(new AphrontMultiColumnView()) | ||||
| ->addColumn($column) | ->addColumn($column) | ||||
| ->addColumn($column2) | |||||
| ->setFluidLayout(true) | ->setFluidLayout(true) | ||||
| ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); | ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); | ||||
| // Baby Got Back Buttons | // Baby Got Back Buttons | ||||
| $column = array(); | $column = array(); | ||||
| $icons = array('Asana', 'Github', 'Facebook', 'Google', 'LDAP'); | $icons = array('Asana', 'Github', 'Facebook', 'Google', 'LDAP'); | ||||
| foreach ($icons as $icon) { | foreach ($icons as $icon) { | ||||
| $image = id(new PHUIIconView()) | $image = id(new PHUIIconView()) | ||||
| ->setSpriteSheet(PHUIIconView::SPRITE_LOGIN) | ->setSpriteSheet(PHUIIconView::SPRITE_LOGIN) | ||||
| ->setSpriteIcon($icon); | ->setSpriteIcon($icon); | ||||
| $column[] = id(new PHUIButtonView()) | $column[] = id(new PHUIButtonView()) | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setSize(PHUIButtonView::BIG) | ->setSize(PHUIButtonView::BIG) | ||||
| ->setColor(PHUIButtonView::GREY) | ->setColor(PHUIButtonView::GREY) | ||||
| ->setIcon($image) | ->setIcon($image) | ||||
| ->setText('Login or Register') | ->setText('Login or Register') | ||||
| ->setSubtext($icon) | ->setSubtext($icon) | ||||
| ->addClass(PHUI::MARGIN_MEDIUM_RIGHT); | ->addClass(PHUI::MARGIN_MEDIUM_RIGHT); | ||||
| } | } | ||||
| $layout4 = id(new AphrontMultiColumnView()) | $layout5 = id(new AphrontMultiColumnView()) | ||||
| ->addColumn($column) | ->addColumn($column) | ||||
| ->setFluidLayout(true) | ->setFluidLayout(true) | ||||
| ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); | ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); | ||||
| // Set it and forget it | // Set it and forget it | ||||
| $head1 = id(new PHUIHeaderView()) | $head1 = id(new PHUIHeaderView()) | ||||
| ->setHeader('phutil_tag'); | ->setHeader('phutil_tag'); | ||||
| $head2 = id(new PHUIHeaderView()) | $head2 = id(new PHUIHeaderView()) | ||||
| ->setHeader('PHUIButtonView'); | ->setHeader('PHUIButtonView'); | ||||
| $head3 = id(new PHUIHeaderView()) | $head3 = id(new PHUIHeaderView()) | ||||
| ->setHeader('Icon Buttons'); | ->setHeader('Icon Buttons'); | ||||
| $head4 = id(new PHUIHeaderView()) | $head4 = id(new PHUIHeaderView()) | ||||
| ->setHeader('Simple Buttons'); | |||||
| $head5 = id(new PHUIHeaderView()) | |||||
| ->setHeader('Big Icon Buttons'); | ->setHeader('Big Icon Buttons'); | ||||
| $wrap1 = id(new PHUIBoxView()) | $wrap1 = id(new PHUIBoxView()) | ||||
| ->appendChild($layout1) | ->appendChild($layout1) | ||||
| ->addMargin(PHUI::MARGIN_LARGE); | ->addMargin(PHUI::MARGIN_LARGE); | ||||
| $wrap2 = id(new PHUIBoxView()) | $wrap2 = id(new PHUIBoxView()) | ||||
| ->appendChild($layout2) | ->appendChild($layout2) | ||||
| ->addMargin(PHUI::MARGIN_LARGE); | ->addMargin(PHUI::MARGIN_LARGE); | ||||
| $wrap3 = id(new PHUIBoxView()) | $wrap3 = id(new PHUIBoxView()) | ||||
| ->appendChild($layout3) | ->appendChild($layout3) | ||||
| ->addMargin(PHUI::MARGIN_LARGE); | ->addMargin(PHUI::MARGIN_LARGE); | ||||
| $wrap4 = id(new PHUIBoxView()) | $wrap4 = id(new PHUIBoxView()) | ||||
| ->appendChild($layout4) | ->appendChild($layout4) | ||||
| ->addMargin(PHUI::MARGIN_LARGE); | ->addMargin(PHUI::MARGIN_LARGE); | ||||
| $wrap5 = id(new PHUIBoxView()) | |||||
| ->appendChild($layout5) | |||||
| ->addMargin(PHUI::MARGIN_LARGE); | |||||
| return array($head1, $wrap1, $head2, $wrap2, $head3, $wrap3, | return array($head1, $wrap1, $head2, $wrap2, $head3, $wrap3, | ||||
| $head4, $wrap4, | $head4, $wrap4, $head5, $wrap5, | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||