Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
chore: Emakiが将来どうなるかのスケッチを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
pxfnc committed Feb 11, 2024
1 parent 4d5b5b9 commit fb18267
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,42 @@ emaki = [
```shell
$ npx elm-emaki
```

## 将来的なemakiの例

動作を見たいview関数の実装`someView : Args -> Html msg`があった時、emakiファイルをこんな
感じに書くと動作確認できる画面ができる予定。


```elm
import Emaki


-- elm-emakiで表示したいviewをimport
import YourProject.UserProfileCard (view)


-- viewはこんな感じのものを想定
-- view : { userName : String, active : Boolean } -> Html msg


main : Emaki.Emaki
main =
Emaki.chapters
[ Emaki.chapter
{ view = view
, props =
[ Emaki.text
{ init = ""
, label = "user name"
, onChange = \newValue viewProp -> { viewProp | userName = newValue }
}
, Emaki.toggle
{ init = False
, label = "active?"
, onChange = \newValue viewProp -> { viewProp | active = newValue }
}
]
}
]
```

0 comments on commit fb18267

Please sign in to comment.