Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UI Component 作ってますか?
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nobuki Inoue
August 29, 2018
Programming
560
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
UI Component 作ってますか?
Nobuki Inoue
August 29, 2018
More Decks by Nobuki Inoue
See All by Nobuki Inoue
Webサービスを作ってみて気づいたこと
black_trooper
0
490
10年使ったDBFluteに思う事
black_trooper
0
530
Riot.jsでSemanticUIを使ってみる
black_trooper
2
600
Other Decks in Programming
See All in Programming
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.3k
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
160
symfony/aiとlaravel/boost
77web
0
120
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
5.1k
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
350
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
710
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
180
関数型プログラミングのメリットって何だろう?
wanko_it
0
150
Performance Engineering for Everyone
elenatanasoiu
0
260
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The Spectacular Lies of Maps
axbom
PRO
1
850
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Docker and Python
trallard
47
3.9k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
340
Paper Plane
katiecoart
PRO
1
52k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Transcript
UI Component 作ってますか? 2018/08/29 Riot.js LT大会@Tokyo #1
HELLO! 井上 暢己(いのうえ のぶき) @black_trooper フリーのWebエンジニア フロントエンドとサーバサイドどっちもやって ます。 2
Component 分割してますか? Riot.js はコンポーネント志向のUIフレームワークです 3
1 Page 1 Component 4 <sample> <div class="menu"> <a class="header
item" href="home"> <img src="images/logo.png" alt="" />Sampleサービス </a> <a class="item" href="contact">お問い合わせ</a> </div> <div class="tweet" each="{ tweet in tweets }"> <div class="item-header">{ tweet.full_name }</div> <div class="item"> { tweet.text } </div> <div class="item-footer"> <span class="reply">{ tweet.reply }件の返信</span> <span class="retweet">{ tweet.retweet }件のリツイート</span> <span class="favorite">{ tweet.favorite } いいね</span> </div> </div> </sample>
分割された Component 5 <common-header class="menu"> <a class="header item" href="home"> <img
src="images/logo.png" alt="" />Sampleサービス </a> <a class="item" href="contact">お問い合わせ</a> </common-header> <item-footer class="item-footer"> <span class="reply">{ opts.tweet.reply }件の返信</span> <span class="retweet">{ opts.tweet.retweet }件のリツイート</span> <span class="favorite">{ opts.tweet.favorite } いいね</span> </item-footer> <sample> <common-header></common-header> <div class="tweet" each="{ tweet in tweets }"> <div class="item-header">{ tweet.full_name }</div> <div class="item"> { tweet.text } </div> <item-footer tweet="{ tweet }"></item-footer> </div> </sample>
Component 公開してますか? 「自サイトに特化してるから他では使い道ないよ」 6 「たいしたもの作ってないし・・・」
他で使い道ないよ の例 Checkbox Component 初期値に戻す reset メ ソッド 初期値から変更された かを確認する
changed メソッド 7 <xx-checkbox> <label> <input type="checkbox" checked="{ checked }" onclick="{ click }" /> <yield /> </label> <script> this.checked = false this.defaultChecked = this.checked this.click = () => { this.checked = !this.checked } this.reset = () => { this.checked = this.defaultChecked } this.changed = () => { return this.checked !== this.defaultChecked } </script> </xx-checkbox> <xx-checkbox>利用規約に同意します </xx-checkbox> CSSの都合でこんな要望があることも - <yield /> は <span> で囲みたい - <input> に xxx というクラスを追加したい
CSSとセットじゃないと使いにくい 8
CSS Framework 使ってますか? 9 CSS Framework に特化した Component でいいじゃん!
CSS Framework の特徴 10 ▸ カンタンにカッコイイWebサイト が作成できる ▸ レスポンシブデザインに対応し ている
▸ JavaScript(主にJQuery)で DOMを直接いじる ▸ 仮装DOMでページを構成する UI Framework とは相性が悪い ▸ 対策として Component set が 作られた
Component set の一例 11 Angular React Vue Riot Bootstrap ngbootstrap
reactstrap Bootstrap + Vue Riot-bootstrap (v3) Semantic UI Semantic UI Angular (1.x) Semantic UI React Semantic UI Vue Semantic UI Riot Material Angular Material MATERIAL-UI Vue Material Riot MaterialUI Other RiotGear (for Braze CSS) (Riot 2.x)
Semantic UI Riot https://github.com/black-tr ooper/semantic-ui-riot Place your screenshot here 12
<su-radio-group ref="radio"> <su-radio value="1">Radio choice1</su-radio> <su-radio value="2">Radio choice2</su-radio> </su-radio-group> <script>
const getRadioValue = () => { return this.refs.radio.value } </script> Radio 13 <div class="ui radio checkbox"> <input type="radio" name="radio" ref="radio1" value="1"> <label>Radio choice1</label> </div> <div class="ui radio checkbox"> <input type="radio" name="radio" ref="radio2" value="2"> <label>Radio choice</label> </div> <script> const getRadioValuebyJQuery = () => { return $("[name=radio]:checked").val() } const getRadioValueByRiotRefs = () => { return this.refs.radio1.checked ? this.refs.radio1.value : (this.refs.radio2.checked ? this.refs.radio2.value : null) } </script> Before After 値の取得も簡単に! refsだけで頑張るとツラい TagとCSSの記述が簡潔
npm trends から見る UI Componentの 需要 どの UI Component も需要があるっぽい
14
まとめ ▸ Riot.js の Component を積極的に公開し よう❗ ▸ CSS Framework
に特化した Component も結構需要あるよ! ▸ 既存 Component set にない機能を作るも よし、推しCSS Framework向けの Component setを作るもよし ▸ Semantic UI Riot も使ってみてね 15 https://github.com/black-trooper/semantic-ui-riot
16 THANKS! ご清聴ありがとうございました。