Skip to content

Instantly share code, notes, and snippets.

@jjergus
Created August 3, 2020 22:22
Show Gist options
  • Save jjergus/0f6e22eb13c3c429a2e9e6f577aa82c6 to your computer and use it in GitHub Desktop.
Save jjergus/0f6e22eb13c3c429a2e9e6f577aa82c6 to your computer and use it in GitHub Desktop.
diff --git a/src/site/xhp/ui-notice.php b/src/site/xhp/ui-notice.php
index 394e3125..59ab6331 100644
--- a/src/site/xhp/ui-notice.php
+++ b/src/site/xhp/ui-notice.php
@@ -9,38 +9,39 @@
*
*/
+namespace HHVM\UserDocumentation\XHP\Examples\ui;
+
+use namespace Facebook\XHP\Core as x;
+use type Facebook\XHP\HTML\div;
use type HHVM\UserDocumentation\UIGlyphIcon;
-final xhp class ui:notice extends :x:element {
+final xhp class notice extends x\element {
attribute
string className,
UIGlyphIcon glyph,
enum {'small', 'medium', 'large'} size = 'medium',
enum {'default', 'success', 'special', 'warning'} use = 'default';
- protected function render(): XHPRoot {
+ protected async function renderAsync(): Awaitable<x\node> {
$holder_class = ($this->:className !== null)
? "noticeHolder ".$this->:className
: "noticeHolder";
$notice_class = "notice notice".
- ucfirst($this->:use).
+ \ucfirst($this->:use).
" notice".
- ucfirst($this->:size);
+ \ucfirst($this->:size);
- $notice =
- <div class={$notice_class} role="note">
- {$this->getChildren()}
- </div>;
+ $notice = <div class={$notice_class} role="note" />;
$glyph = $this->:glyph;
if ($glyph !== null) {
$holder_class .= " noticeWithGlyph";
- $notice->prependChild(<ui:glyph icon={$glyph} />);
+ $notice->appendChild(<glyph icon={$glyph} />);
}
return
<div class={$holder_class}>
- {$notice}
+ {$notice->appendChild($this->getChildren())}
</div>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment