Feedback Form Link: https://docs.google.com/forms/d/e/1FAIpQLSduti27Gold0T3WDtSe04Hi3V-yaBG0ChqAbS-t3-qoe4qsbA/viewform
GraphQL & Reason talk https://www.youtube.com/watch?v=tUIvl2pe8CQ
Ken Wheeler - ReasonML is Serious Business
Create a data-structure for a chess figure with the following attributes: color, position, kind
- The color can be either black / white
- The position has 2 dimensions on a typical chess board
- The kind describes the value of the figure (king, tower, pawn …)
Put your data-structures in action by storing 2 chess figures in a collection called figures:
- Figure 1: Black, King, on position A1
- Figure 2: White, Tower, on position C7
I recommend to use the playground for this example: https://reasonml.github.io/en/try
Alternative playground: https://sketch.sh/
Tip: You may use lists, arrays, tuples, variants for these tasks
Create a file Data.re and inside create a list of places with the following properties
- id (generate uuids via https://www.uuidgenerator.net/)
- name
- description
- image containing an url, attribution and attributionUrl (optional)
- address
- phone (optional)
- email (optional)
- coordinates containing lat and lng
- Create an Array of names based on the places data structure. Print out the array for verification.
Try it without and then use fast-pipe for this task.
- Pro lesson: create a search funtion. You can give it a string and it will find items based on the place name. For an empty string it returns all entries. Note: There is String and Js.String when using BuckleScript
- Setup the editor -> https://reasonml.github.io/docs/en/editor-plugins
- Create a new ReasonReact BuckleScript project -> https://reasonml.github.io/reason-react/docs/en/installation
npm install -g bs-platform
bsb -init my-react-app -theme react
cd my-react-app && npm install && npm start
# in another tab
npm run webpack
# in another tab
npm run server
- Add your Data.re file
- Render a list of the place names
-
Render the image of each place. Depending on if the attributionUrl is available either render a Link or just the text.
-
Render the phone (which is not always in the list)
-
Pro lesson: Render the description as markdown
Internal note: https://github.com/ReasonVienna/reason-conf/blob/master/src/layouts/util.re
- Style a component using bs-emotion, bs-css or something similar.
-
Allow users to filter the attractions using an input field.
-
Pro lesson: add labels per place and allow to filter by them
Hint: For advanced form management you might like https://github.com/alexfedoseev/re-formality