Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.3.0] - 2020-07-14

Comment on lines +10 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this. Our release bot includes this automatically

Suggested change
## [0.3.0] - 2020-07-14

### Added
- Prop for the component already starting open

## [0.2.0] - 2020-05-06

### Added
Expand Down
6 changes: 6 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
Use this component to check the availability in-store pickup for selected SKU.
This component uses the `ProductContext` and is meant to be used inside the `store.product` block.

## Configuration

| Prop name | Type | Description | Default value |
| ----------------------- | --------- | --------------------------------------------------------------------------------- | -------------------- |
| `initialOpen` | `boolean` | Makes the component open by default, without having to click on the button. | `false` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change to initialState?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the value open or closed


#### Customization

In order to apply CSS customizations on 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).
Expand Down
4 changes: 3 additions & 1 deletion react/components/ContainerStateSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const CSS_HANDLES = [
interface Props {
googleMapsKey?: string
showSelectSkuMessage: boolean
initialOpen: boolean
}

function usePickupFromSession() {
Expand Down Expand Up @@ -58,9 +59,10 @@ function usePickupFromSession() {
const ContainerStateSelector: FC<Props> = ({
showSelectSkuMessage,
googleMapsKey,
initialOpen
}) => {
const handles = useCssHandles(CSS_HANDLES)
const [showAddressForm, setShowForm] = useState(false)
const [showAddressForm, setShowForm] = useState(initialOpen)
const { favoritePickup, setFavoritePickup } = usePickupFromSession()

if (showSelectSkuMessage) {
Expand Down
4 changes: 3 additions & 1 deletion react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ type LogisticsQuery = DataValue<LogisticsResponse>

interface InjectedProps {
logisticsQuery: LogisticsQuery
initialOpen: boolean
}

const StorePickup: FC<{} & InjectedProps> = ({ logisticsQuery }) => {
const StorePickup: FC<{} & InjectedProps> = ({ logisticsQuery, initialOpen }) => {
const { skuSelector } = useProduct()
const handles = useCssHandles(CSS_HANDLES)

Expand All @@ -29,6 +30,7 @@ const StorePickup: FC<{} & InjectedProps> = ({ logisticsQuery }) => {
<ContainerStateSelector
showSelectSkuMessage={skuSelector.isVisible && !skuSelector.areAllVariationsSelected}
googleMapsKey={logisticsQuery.logistics && logisticsQuery.logistics.googleMapsKey}
initialOpen={initialOpen}
/>
</div>
)
Expand Down