From 116f6c2ba3030a87375d108bc781a11dd81ac7e1 Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Tue, 21 May 2019 13:41:34 -0300 Subject: [PATCH 01/11] Add LocaleSwitcher Creating LocaleSwitcher Add CHANGELOG --- CHANGELOG.md | 2 ++ README.md | 25 +++++++++++++------------ messages/context.json | 1 + messages/en.json | 1 + messages/es.json | 1 + messages/pt.json | 1 + react/legacy/components/FixedContent.js | 5 +++++ react/legacy/components/TopMenu.js | 2 ++ react/legacy/defaults.js | 15 +++++++++++++++ react/legacy/index.js | 12 +++++++++++- store/blocks.json | 5 ++++- store/interfaces.json | 3 +++ 12 files changed, 59 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 907adf30..fec06a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Adds support for `localeSwitcher`. ## [2.17.0] - 2019-04-29 diff --git a/README.md b/README.md index 48d5c01b..fa1ad431 100644 --- a/README.md +++ b/README.md @@ -107,18 +107,19 @@ Note that every `header` implementation must append all required blocks within i Through the Storefront, you can change the headers's behavior and interface. However, you also can make in your theme app, as Store theme does. -| Prop name | Type | Description | Default value | -| ---------------------- | --------- | ------------------------------------------------- | ------------------------------------------------------------------------ | -| `leanWhen` | `String` | Cases in which the menu is in lean mode | 'a^' | -| `linkUrl` | `String` | Address opened when the user clicks the logo | '/' | -| `logoUrl` | `String` | URL of the logo image | N/A | -| `logoTitle` | `String` | Alt text for the logo | N/A | -| `logoSize` | `Object` | Sizes of logo in desktop and mobile | `desktop: { width: 132, height: 40 }, mobile: { width: 90, height: 40 }` | -| `showSearchBar` | `Boolean` | Sets whether the search bar is visible or not | true | -| `showLogin` | `Boolean` | Sets whether the login button is displayed or not | true | -| `iconClasses` | `String` | Classes for icons | 'c-on-base' | -| `labelClasses` | `String` | Classes for labels | 'c-on-base' | -| `collapsibleAnimation` | `Object` | Collapsible animation controlling | [Collapsible Animation](#collapsible-animation) | +| Prop name | Type | Description | Default value | +| ---------------------- | --------- | ---------------------------------------------------- | ------------------------------------------------------------------------ | +| `leanWhen` | `String` | Cases in which the menu is in lean mode | 'a^' | +| `linkUrl` | `String` | Address opened when the user clicks the logo | '/' | +| `logoUrl` | `String` | URL of the logo image | N/A | +| `logoTitle` | `String` | Alt text for the logo | N/A | +| `logoSize` | `Object` | Sizes of logo in desktop and mobile | `desktop: { width: 132, height: 40 }, mobile: { width: 90, height: 40 }` | +| `showSearchBar` | `Boolean` | Sets whether the search bar is visible or not | true | +| `showLogin` | `Boolean` | Sets whether the login button is displayed or not | true | +| `showLocaleSwitcher` | `Boolean` | Sets whether the locale switcher is displayed or not | true | +| `iconClasses` | `String` | Classes for icons | 'c-on-base' | +| `labelClasses` | `String` | Classes for labels | 'c-on-base' | +| `collapsibleAnimation` | `Object` | Collapsible animation controlling | [Collapsible Animation](#collapsible-animation) | ##### Collapsible Animation diff --git a/messages/context.json b/messages/context.json index 5ef69e20..910038e9 100644 --- a/messages/context.json +++ b/messages/context.json @@ -6,6 +6,7 @@ "admin/editor.header.link.url": "admin/editor.header.link.url", "admin/editor.header.show.searchbar.title": "admin/editor.header.show.searchbar.title", "admin/editor.header.show.login.title": "admin/editor.header.show.login.title", + "admin/editor.header.show.localeswitcher.title": "admin/editor.header.show.localeswitcher.title", "store/header.search-placeholder": "store/header.search-placeholder", "store/header.search-emptyPlaceholder": "store/header.search-emptyPlaceholder", "store/header.topMenu.minicart.icon.label": "store/header.topMenu.minicart.icon.label", diff --git a/messages/en.json b/messages/en.json index 375b9ad3..9067452d 100644 --- a/messages/en.json +++ b/messages/en.json @@ -6,6 +6,7 @@ "admin/editor.header.link.url": "Logo link", "admin/editor.header.show.searchbar.title": "Show SearchBar", "admin/editor.header.show.login.title": "Show Login", + "admin/editor.header.show.localeswitcher.title": "Show Locale Switcher", "store/header.search-placeholder": "Search for products, brands...", "store/header.search-emptyPlaceholder": "No matches found", "store/header.topMenu.minicart.icon.label": "My Cart", diff --git a/messages/es.json b/messages/es.json index 6374a1ea..34fa578e 100644 --- a/messages/es.json +++ b/messages/es.json @@ -5,6 +5,7 @@ "admin/editor.header.logo.image": "Imagen del logotipo", "admin/editor.header.link.url": "Link del logotipo", "admin/editor.header.show.searchbar.title": "Mostrar Busca", + "admin/editor.header.show.localeswitcher.title": "Mostrar alternador de localidade", "admin/editor.header.show.login.title": "Mostrar Login", "store/header.search-placeholder": "Búsqueda por productos, marcas...", "store/header.search-emptyPlaceholder": "Ningún resultado encontrado", diff --git a/messages/pt.json b/messages/pt.json index 7752486d..16181a0f 100644 --- a/messages/pt.json +++ b/messages/pt.json @@ -6,6 +6,7 @@ "admin/editor.header.link.url": "Link da Logo", "admin/editor.header.show.searchbar.title": "Mostrar Busca", "admin/editor.header.show.login.title": "Mostrar Login", + "admin/editor.header.show.localeswitcher.title": "Mostrar alternador de localidade", "store/header.search-placeholder": "Busque por produtos, marcas...", "store/header.search-emptyPlaceholder": "Nenhum resultado encontrado", "store/header.topMenu.minicart.icon.label": "Meu Carrinho", diff --git a/react/legacy/components/FixedContent.js b/react/legacy/components/FixedContent.js index f6dd779d..9484f8ad 100644 --- a/react/legacy/components/FixedContent.js +++ b/react/legacy/components/FixedContent.js @@ -22,6 +22,7 @@ const FixedContent = ({ logoSize, showSearchBar, showLogin, + showLocaleSwitcher, iconClasses, labelClasses, mobile, @@ -86,6 +87,10 @@ const FixedContent = ({ )} + + {showLocaleSwitcher && ( + + )} Date: Thu, 23 May 2019 10:11:38 -0300 Subject: [PATCH 02/11] Update snapshots --- .../__snapshots__/Header.test.js.snap | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/react/__tests__/__snapshots__/Header.test.js.snap b/react/__tests__/__snapshots__/Header.test.js.snap index 8640d205..75854922 100644 --- a/react/__tests__/__snapshots__/Header.test.js.snap +++ b/react/__tests__/__snapshots__/Header.test.js.snap @@ -47,6 +47,11 @@ exports[`Header Component should match snapshot mobile with leanmode 1`] = ` +
+ locale-switcher +
@@ -145,6 +150,11 @@ exports[`Header Component should match snapshot mobile without leanmode 1`] = `
+
+ locale-switcher +
@@ -241,6 +251,11 @@ exports[`Header Component should match snapshot with leanmode 1`] = `
+
+ locale-switcher +
@@ -339,6 +354,11 @@ exports[`Header Component should match snapshot without leanmode 1`] = `
+
+ locale-switcher +
From 8738d2fae759b559bdf5d9f0d6d9a3a75847957a Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Thu, 23 May 2019 16:45:30 -0300 Subject: [PATCH 03/11] Fix issues --- CHANGELOG.md | 2 +- messages/es.json | 2 +- messages/pt.json | 2 +- react/legacy/defaults.js | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fec06a6e..2247aeb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added -- Adds support for `localeSwitcher`. +- Support for `localeSwitcher`. ## [2.17.0] - 2019-04-29 diff --git a/messages/es.json b/messages/es.json index 34fa578e..9dd2eb71 100644 --- a/messages/es.json +++ b/messages/es.json @@ -5,7 +5,7 @@ "admin/editor.header.logo.image": "Imagen del logotipo", "admin/editor.header.link.url": "Link del logotipo", "admin/editor.header.show.searchbar.title": "Mostrar Busca", - "admin/editor.header.show.localeswitcher.title": "Mostrar alternador de localidade", + "admin/editor.header.show.localeswitcher.title": "Mostrar selector de localidade", "admin/editor.header.show.login.title": "Mostrar Login", "store/header.search-placeholder": "Búsqueda por productos, marcas...", "store/header.search-emptyPlaceholder": "Ningún resultado encontrado", diff --git a/messages/pt.json b/messages/pt.json index 16181a0f..e4213b10 100644 --- a/messages/pt.json +++ b/messages/pt.json @@ -6,7 +6,7 @@ "admin/editor.header.link.url": "Link da Logo", "admin/editor.header.show.searchbar.title": "Mostrar Busca", "admin/editor.header.show.login.title": "Mostrar Login", - "admin/editor.header.show.localeswitcher.title": "Mostrar alternador de localidade", + "admin/editor.header.show.localeswitcher.title": "Mostrar seletor de localidade", "store/header.search-placeholder": "Busque por produtos, marcas...", "store/header.search-emptyPlaceholder": "Nenhum resultado encontrado", "store/header.topMenu.minicart.icon.label": "Meu Carrinho", diff --git a/react/legacy/defaults.js b/react/legacy/defaults.js index 5e19f795..5cb67785 100644 --- a/react/legacy/defaults.js +++ b/react/legacy/defaults.js @@ -84,13 +84,11 @@ export const icons = { export const localeSwitcher = { propTypes: { showLocaleSwitcher: PropTypes.bool, - bottom: PropTypes.bool, color: PropTypes.string, hoverColor: PropTypes.string, }, defaultProps: { showLocaleSwitcher: true, - bottom: false, color: 'near-black', hoverColor: 'rebel-pink', } From 1acad0b176d9c419bf1b8b245f18d37f7f6e08eb Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Mon, 27 May 2019 10:00:10 -0300 Subject: [PATCH 04/11] Remove unused props --- README.md | 1 - react/legacy/components/FixedContent.js | 5 +---- react/legacy/components/TopMenu.js | 2 -- react/legacy/defaults.js | 13 ------------- react/legacy/index.js | 12 +----------- 5 files changed, 2 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index fa1ad431..b3bc3f55 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,6 @@ Through the Storefront, you can change the headers's behavior and interface. How | `logoSize` | `Object` | Sizes of logo in desktop and mobile | `desktop: { width: 132, height: 40 }, mobile: { width: 90, height: 40 }` | | `showSearchBar` | `Boolean` | Sets whether the search bar is visible or not | true | | `showLogin` | `Boolean` | Sets whether the login button is displayed or not | true | -| `showLocaleSwitcher` | `Boolean` | Sets whether the locale switcher is displayed or not | true | | `iconClasses` | `String` | Classes for icons | 'c-on-base' | | `labelClasses` | `String` | Classes for labels | 'c-on-base' | | `collapsibleAnimation` | `Object` | Collapsible animation controlling | [Collapsible Animation](#collapsible-animation) | diff --git a/react/legacy/components/FixedContent.js b/react/legacy/components/FixedContent.js index 9484f8ad..f26d61a9 100644 --- a/react/legacy/components/FixedContent.js +++ b/react/legacy/components/FixedContent.js @@ -22,7 +22,6 @@ const FixedContent = ({ logoSize, showSearchBar, showLogin, - showLocaleSwitcher, iconClasses, labelClasses, mobile, @@ -88,9 +87,7 @@ const FixedContent = ({
)} - {showLocaleSwitcher && ( - - )} + Date: Thu, 23 May 2019 19:36:07 -0300 Subject: [PATCH 05/11] Add CSS overrides on row background --- react/components/Row.css | 3 ++- react/components/Row.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/react/components/Row.css b/react/components/Row.css index a5c04107..9ff17ac0 100644 --- a/react/components/Row.css +++ b/react/components/Row.css @@ -1 +1,2 @@ -.headerRow {} \ No newline at end of file +.headerRow {} +.headerRowBackground {} \ No newline at end of file diff --git a/react/components/Row.tsx b/react/components/Row.tsx index c5b9a614..37e7d4fb 100644 --- a/react/components/Row.tsx +++ b/react/components/Row.tsx @@ -26,7 +26,7 @@ const Row: FunctionComponent = ({
Date: Thu, 23 May 2019 19:40:19 -0300 Subject: [PATCH 06/11] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2247aeb3..2b6e7311 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Support for `localeSwitcher`. ## [2.17.0] - 2019-04-29 +### Added +- Added CSS Override class to header row background. ### Added - Allow `drawer` block on `header-row`. From cff968b05d613e9b8d194333738a245880184738 Mon Sep 17 00:00:00 2001 From: Gabriel Galc Date: Fri, 24 May 2019 16:23:06 -0300 Subject: [PATCH 07/11] Add extra CSS module class --- react/components/Row.css | 3 ++- react/components/Row.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/react/components/Row.css b/react/components/Row.css index 9ff17ac0..392df4ff 100644 --- a/react/components/Row.css +++ b/react/components/Row.css @@ -1,2 +1,3 @@ .headerRow {} -.headerRowBackground {} \ No newline at end of file +.headerRowBackground {} +.headerRowContainer {} \ No newline at end of file diff --git a/react/components/Row.tsx b/react/components/Row.tsx index 37e7d4fb..9f8357f9 100644 --- a/react/components/Row.tsx +++ b/react/components/Row.tsx @@ -19,7 +19,7 @@ const Row: FunctionComponent = ({ inverted, blockClass, }) => { - const content =
{children}
+ const content =
{children}
return ( From 35ebf6f90dfa0f4b55e7088f266f29e64ed3cbe3 Mon Sep 17 00:00:00 2001 From: Gabriel Galc Date: Sat, 25 May 2019 14:34:23 -0300 Subject: [PATCH 08/11] Release v2.18.0 --- CHANGELOG.md | 2 ++ manifest.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b6e7311..71c18bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Support for `localeSwitcher`. +## [2.18.0] - 2019-05-25 + ## [2.17.0] - 2019-04-29 ### Added - Added CSS Override class to header row background. diff --git a/manifest.json b/manifest.json index e32a94c9..f261d632 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "vendor": "vtex", "name": "store-header", - "version": "2.17.0", + "version": "2.18.0", "title": "VTEX Store Header", "defaultLocale": "pt-BR", "description": "The VTEX Store Header component", From 6c99e5838a814036be55fea82a4d7300382e5d01 Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Tue, 21 May 2019 13:41:34 -0300 Subject: [PATCH 09/11] Add LocaleSwitcher Creating LocaleSwitcher Add CHANGELOG --- react/legacy/components/FixedContent.js | 2 +- react/legacy/components/TopMenu.js | 2 ++ react/legacy/defaults.js | 15 +++++++++++++++ react/legacy/index.js | 12 +++++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/react/legacy/components/FixedContent.js b/react/legacy/components/FixedContent.js index f26d61a9..750b0888 100644 --- a/react/legacy/components/FixedContent.js +++ b/react/legacy/components/FixedContent.js @@ -86,7 +86,7 @@ const FixedContent = ({
)} - + Date: Thu, 23 May 2019 16:45:30 -0300 Subject: [PATCH 10/11] Fix issues --- react/legacy/defaults.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/react/legacy/defaults.js b/react/legacy/defaults.js index 5e19f795..5cb67785 100644 --- a/react/legacy/defaults.js +++ b/react/legacy/defaults.js @@ -84,13 +84,11 @@ export const icons = { export const localeSwitcher = { propTypes: { showLocaleSwitcher: PropTypes.bool, - bottom: PropTypes.bool, color: PropTypes.string, hoverColor: PropTypes.string, }, defaultProps: { showLocaleSwitcher: true, - bottom: false, color: 'near-black', hoverColor: 'rebel-pink', } From 5601be71c86d09156f433c864278bfcf503a87b5 Mon Sep 17 00:00:00 2001 From: Thalyta Fabrine Date: Tue, 28 May 2019 08:18:00 -0300 Subject: [PATCH 11/11] Dependency for locale switcher --- manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index f261d632..2ecd2bf3 100644 --- a/manifest.json +++ b/manifest.json @@ -28,6 +28,7 @@ "vtex.store-components": "3.x", "vtex.store-icons": "0.x", "vtex.rich-text": "0.x", - "vtex.store-drawer": "0.x" + "vtex.store-drawer": "0.x", + "vtex.locale-switcher": "0.x" } }