diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e745fa..2d05fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Fixes of i18n on readme file. + ## [0.16.2] - 2022-06-13 ### Fixed - Removed transition from in `"Overlay"`. diff --git a/docs/README.md b/docs/README.md index cc9ef54..3327e92 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,16 +1,21 @@ 📢 Use this project, [contribute](https://github.com/vtex-apps/drawer) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion). -# Store Drawer +# Drawer [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) -This component allows you to have a sliding drawer for your menus. This is specially handy for mobile layouts. +The **Drawer** component is a sliding panel that displays additional options and menus when expanded. It is typically used in mobile layouts and responsive web designs where screen space is limited. + +![drawer](https://github.com/vtex-apps/reviews-and-ratings/assets/60782333/46358b77-e41a-4014-8443-c65cbe947fc2) + +When closed, the **Drawer** component is represented by an icon button positioned at the edge of the screen. Upon interaction, the drawer slides into view, revealing its content. Users can interact with the exposed content, perform actions, and navigate menus. To dismiss the drawer, users can either tap outside the drawer or use the close button. ## Configuration -Add the app to your theme's dependencies on the `manifest.json`, for example: +1. Open your store theme in the code editor of your preference. +2. Open the `manifest.json` file and add the `vtex.store-drawer` app to your store theme dependencies as in the following: ```json "dependencies": { @@ -18,7 +23,7 @@ Add the app to your theme's dependencies on the `manifest.json`, for example: } ``` -Then, you need to add the `drawer` block into your app. The following is an example taken from [Store Theme](https://github.com/vtex-apps/store-theme). +2. Add the `drawer` block to your app. The following example is from the [Store Theme](https://github.com/vtex-apps/store-theme). ```json "drawer": { @@ -39,7 +44,7 @@ Then, you need to add the `drawer` block into your app. The following is an exam }, ``` -There is also a block that can be used for customizing the icon that triggers the opening of the drawer, it's called `"drawer-trigger"` and can be used as follows: +3. Use the `drawer-trigger` block to customize the icon that triggers the opening of the drawer as follows: ```json "drawer": { @@ -57,7 +62,7 @@ There is also a block that can be used for customizing the icon that triggers th "props": { "text": "Open drawer" } -} +} "menu#drawer": { "children": [ @@ -71,11 +76,10 @@ There is also a block that can be used for customizing the icon that triggers th }, ``` -And there is a block that enables customization of the header that contains the button which closes the drawer. -It's called `"drawer-header"` and can be used in a similar way as `"drawer-trigger"`, here is an example: +4. Use the `drawer-header` block to customize the header containing the button that closes the drawer. For example: -```jsonc -// inside blocks.json +```json +// blocks.json { "drawer": { "blocks": ["drawer-header#my-drawer"] @@ -91,10 +95,12 @@ It's called `"drawer-header"` and can be used in a similar way as `"drawer-trigg } ``` -If you're using this component by itself, you just need to import it inside the component you want to use it in. Here's an example: +### Using the Drawer as a standalone component + +If you are using this component as a standalone module, you will need to import it into the specific component where you want to use it. For example: ```tsx -import { Drawer, DrawerHeader, DrawerCloseButton } from 'vtex.store-drawer' +import { Drawer, DrawerHeader, DrawerCloseButton } from "vtex.store-drawer"; const Menu = () => ( (
  • Link 6
  • -) +); ``` -## Configuration +### Props -The `drawer` block accepts a few props that allow you to customize it. +#### `drawer` -| Prop name | Type | Description | Default value | -| -------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -------------- | -| `maxWidth` | `number` or `string` | Define the open Drawer's maximum width. | `450` | -| `isFullWidth` | `Boolean` | Control whether or not the open Drawer should occupy the full available width. | `false` | -| `slideDirection` | `'horizontal'`|`'vertical'`|`'rightToLeft'`|`'leftToRight'` | Controls the opening animation's direction. | `'horizontal'` | -| `backdropMode` | `'default'`|`'none'` | Controls if it should display the backdrop when the Drawer is open | -| `renderingStrategy` | `'lazy'`|`'eager'` | Controls if it should render the children only when clicked (`lazy`) or as soon as the page loads (`eager`). Enabling the `eager` strategy may increase SEO performance, but the page may be rendered slower | `'lazy'` -| `customPixelEventId` | `string` | Store event ID responsible for triggering the `drawer` to automatically open itself on the interface. | `undefined` | -| `customPixelEventName` | `string` | Store event name responsible for triggering the `drawer` to automatically open itself on the interface. Some examples are: `'addToCart'` and `'removeFromCart'` events. Notice that using this prop will make the drawer open in **every** event with the specified name if no `customPixelEventId` is specified. | `undefined` | +| Prop name | Type | Description | Default value | +| ---------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | +| `maxWidth` | `number` or `string` | Defines the maximum width of the open drawer. | `450` | +| `isFullWidth` | `boolean` | Controls whether the open drawer should occupy the full available width. | `false` | +| `slideDirection` | `'horizontal'`|`'vertical'`|`'rightToLeft'`|`'leftToRight'` | Controls the direction of the opening animation for the drawer. | `'horizontal'` | +| `backdropMode` | `'default'`|`'none'` | Controls whether the backdrop should be displayed when the drawer is open. | | +| `renderingStrategy` | `'lazy'`|`'eager'` | Controls the rendering strategy for the children of the drawer component. It determines whether the children should be rendered only when the drawer is clicked (`lazy`) or immediately when the page loads (`eager`). Enabling the `eager` strategy may improve SEO performance. However, it may also result in slower page rendering. | `'lazy'` | +| `customPixelEventId` | `string` | Defines the store event ID responsible for triggering the `drawer` to automatically open on the interface. | `undefined` | +| `customPixelEventName` | `string` | Defines the store event name responsible for triggering the `drawer` to automatically open on the interface. Some examples are: `'addToCart'` and `'removeFromCart'` events. Note that if no `customPixelEventId` is set, using this prop will cause the drawer to open in every event with the specified name. | `undefined` | -The `drawer-close-button` block accepts the following props to customize it: +#### `drawer-close-button` -| Prop name | Type | Description | Default value | -| --------- | ------------------------ | --------------------------------------------- | ------------- | -| `size` | `Number` | Define the size of the icon inside the button | `30` | -| `type` | `'filled'`|`'line'` | Define the type of the icon | `'line'` | -| `text` | `String` | Define the text inside the button. If `text` is defined, the icon will not be rendered. | `undefined` | +| Prop name | Type | Description | Default value | +| --------- | ------------------------ | -------------------------------------------------------------------------------------- | ------------- | +| `size` | `number` | Defines the size of the icon inside the button. | `30` | +| `type` | `'filled'`|`'line'` | Defines the type of the icon. | `'line'` | +| `text` | `string` | Defines the text inside the button. The icon will not be rendered if `text` is defined. | `undefined` | -The `drawer-trigger` block accepts the following prop to customize it: +#### `drawer-trigger` -| Prop name | Type | Description | Default value | -| -------------------- | -------- | --------------------------------------------------------------------- | ------------- | +| Prop name | Type | Description | Default value | +| -------------------- | -------- | ---------------------------------------------------------------------------------- | ------------- | | `customPixelEventId` | `string` | Defines the event ID to be sent whenever users interact with the Drawer component. | `undefined` | ## Customization -In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on [Using CSS Handles for store customization](https://vtex.io/docs/recipes/style/using-css-handles-for-store-customization). +In order to apply CSS customizations to this and other blocks, follow the instructions in [Using CSS handles for store customizations](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization). -| CSS Handles | +| CSS handles | | ------------------------ | | `drawer` | | `opened` |