From 27e616d1a8795277ed165bc57ca31ae6ee66bb5c Mon Sep 17 00:00:00 2001 From: Pol Moneys Date: Fri, 27 Jan 2023 11:19:19 +0100 Subject: [PATCH] docs : update Readme.md --- Readme.md | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index b5d2d7b..ff5aef5 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,5 @@ -![hospitality-v1 0 0](https://user-images.githubusercontent.com/7026863/213932255-ebd19558-87b0-42e8-a375-66c6d350dbfe.gif) - +Screenshot 2023-01-27 at 10 39 54 ### TLDR @@ -70,6 +69,132 @@ Powered by CSS grid, feel free to override default styles at your own risk using [hospitality-spot="default selected"]{} +``` + +### Recipes + +**display a 6 column 3 rows 'map'** + +```tsx + + + +``` + +**add shape to 6 columns so them are grouped in pairs** + +```tsx + + + +``` + +**chain components for more layout flexibility** + +```tsx + + + + + +``` + +**unleash creativity with custom 'map'** + + +```tsx + +import { MapProp } from "hospitality-react"; + + // Let's build a wedding ceremony layout where 0 === invisible spot +const emptyGap: Array<0 | 1> = [0, 0, 0, 0]; + +const emptyRow: Array<0 | 1> = [ + ...emptyGap, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ...emptyGap, +]; + +const mapWedding: MapProp = [ +// two '1' for bride and groom + [...emptyGap, 0, 0, 0, 1, 0, 1, 0, 0, 0, ...emptyGap], + emptyRow, + // '1's for guests, left for bride's right for groom's + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], + emptyRow, + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], + [...emptyGap, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...emptyGap], +]; + + + + +``` + +Screenshot component + + +**Log user selection from the 'outside'** + +```tsx + + + {({ selected }) => ( + + {selected?.map(item => ( +

+ {item.row}-{item.spot} +

+ ))} +
+ )} +
+ + ``` ### Roadmap