Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(MapboxMap): add storybook stories #312

Merged
merged 48 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f4eac1f
docs(MapboxMap): add story for component
tatimblin Oct 6, 2022
ba42394
docs(MapboxMap): add storybook stories
tatimblin Oct 10, 2022
a865f05
Automated update to repo's documentation from github action
github-actions[bot] Oct 10, 2022
afca03c
chore(MapboxMap): add percy secret
tatimblin Oct 11, 2022
057e0b2
fix(MapboxMap): update custom mapPin story
tatimblin Oct 12, 2022
57b9c6b
chore: change reusable workflow branch
tatimblin Oct 12, 2022
544236f
refactor(MapboxMap): remove initialRenderRef
tatimblin Oct 12, 2022
b0e5303
Update preview.js
tmeyer2115 Oct 12, 2022
85f5939
move story data to separate file
tatimblin Oct 12, 2022
5a92634
update feature branch linting rule
tatimblin Oct 12, 2022
cb49a38
test config
tatimblin Oct 12, 2022
6b69f82
move secret
tatimblin Oct 12, 2022
a13c9e2
change hook
tatimblin Oct 12, 2022
371bcb7
refactor(MapboxMap): use callback hook
tatimblin Oct 12, 2022
b28f601
inputs
tatimblin Oct 12, 2022
b739c46
secrets
tatimblin Oct 12, 2022
31b21eb
update build script
tatimblin Oct 12, 2022
fdf0eeb
npx
tatimblin Oct 12, 2022
a8ed46d
staticDirs
tatimblin Oct 12, 2022
5a2d3f9
env passthrough
tatimblin Oct 12, 2022
e34ed93
remove auto import
tatimblin Oct 12, 2022
9730aa0
remove coordinate passthrough
tatimblin Oct 13, 2022
6ef2919
Automated update to repo's documentation from github action
github-actions[bot] Oct 13, 2022
8437fa8
update env var
tatimblin Oct 13, 2022
485926c
update env var
tatimblin Oct 13, 2022
1bc0565
rename var
tatimblin Oct 13, 2022
2963829
rerun
tatimblin Oct 13, 2022
fc72fc0
add storybook interaction
tatimblin Oct 13, 2022
1733b9b
check for popup content
tatimblin Oct 13, 2022
8b55e00
lint
tatimblin Oct 13, 2022
bf8a2c2
add interaction query to check map loaded
tatimblin Oct 14, 2022
3866537
add data attr on load
tatimblin Oct 14, 2022
543c001
add timeout to loaded check
tatimblin Oct 14, 2022
5be846a
reduce timeout
tatimblin Oct 14, 2022
5e8ca29
remove screen import
tatimblin Oct 14, 2022
81d6424
adjust timeout
tatimblin Oct 14, 2022
d1dde9a
adjust timeout
tatimblin Oct 14, 2022
d7ac312
reorder interactions
tatimblin Oct 14, 2022
e2efd0f
test
tatimblin Oct 14, 2022
8ec3c80
test
tatimblin Oct 14, 2022
3f8d586
adjust timeout
tatimblin Oct 14, 2022
5b30669
adjust timeout
tatimblin Oct 14, 2022
9b64550
add forced await
tatimblin Oct 17, 2022
d5acbab
lint
tatimblin Oct 17, 2022
3554ee0
add a lot of time
tatimblin Oct 17, 2022
955a539
remove forced delay
tatimblin Oct 17, 2022
86ff7bd
Fix Percy snapshots
nmanu1 Oct 18, 2022
2e46f46
Fix TS error and remove extra code
nmanu1 Oct 18, 2022
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
1 change: 1 addition & 0 deletions .github/workflows/percy-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
percy_script: npx percy storybook ./storybook-static
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/run-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Linter

on:
pull_request:
branches: [main, develop]
branches: [main, develop, feature/*]

jobs:
linting:
Expand Down
6 changes: 5 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ module.exports = {
config.resolve.alias['./SearchCore'] = require.resolve('../tests/__fixtures__/core/SearchCore.ts');
config.resolve.alias['../utils/location-operations'] = require.resolve('../tests/__fixtures__/utils/location-operations.ts');
return config;
}
},
env: (config) => ({
...config,
REACT_APP_MAPBOX_API_KEY: process.env.MAPBOX_API_KEY || process.env.REACT_APP_MAPBOX_API_KEY,
tmeyer2115 marked this conversation as resolved.
Show resolved Hide resolved
}),
};
4 changes: 3 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './index.css';
import 'mapbox-gl/dist/mapbox-gl.css';
tatimblin marked this conversation as resolved.
Show resolved Hide resolved
import { SearchCoreDecorator } from '../tests/__fixtures__/core/SearchCore';
import { runOnly } from './wcagConfig';

Expand All @@ -22,6 +23,7 @@ export const parameters = {
'SearchBar',
'UniversalResults',
'VerticalResults',
'MapboxMap',
'DirectAnswer',
'FilterSearch',
'StaticFilters',
Expand All @@ -42,4 +44,4 @@ export const parameters = {
};

// Add the decorator to all stories
export const decorators = [SearchCoreDecorator];
export const decorators = [SearchCoreDecorator];
5 changes: 3 additions & 2 deletions docs/search-ui-react.pincomponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ A functional component that can be used to render a custom marker on the map.

```typescript
export declare type PinComponent<T> = (props: {
result?: Result<T>;
index?: number;
index: number;
mapbox: Map;
result: Result<T>;
}) => JSX.Element;
```
6 changes: 4 additions & 2 deletions etc/search-ui-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DirectAnswer as DirectAnswer_2 } from '@yext/search-headless-react';
import { HighlightedValue } from '@yext/search-headless-react';
import { LngLat } from 'mapbox-gl';
import { LngLatBounds } from 'mapbox-gl';
import { Map as Map_2 } from 'mapbox-gl';
import { MapboxOptions } from 'mapbox-gl';
import { Matcher } from '@yext/search-headless-react';
import { NumberRangeValue } from '@yext/search-headless-react';
Expand Down Expand Up @@ -419,8 +420,9 @@ export interface PaginationProps {

// @public
export type PinComponent<T> = (props: {
result?: Result<T>;
index?: number;
index: number;
mapbox: Map_2;
result: Result<T>;
}) => JSX.Element;

// @public
Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_MAPBOX_API_KEY=[[Your Mapbox API Key]]
oshi97 marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 10 additions & 2 deletions src/components/MapboxMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import ReactDOM from 'react-dom';
*
* @public
*/
export type PinComponent<T> = (props: { result?: Result<T>, index?: number }) => JSX.Element;
export type PinComponent<T> = (props: {
index: number,
mapbox: Map,
result: Result<T>
}) => JSX.Element;

/**
* A function use to derive a result's coordinate.
Expand Down Expand Up @@ -132,7 +136,11 @@ export function MapboxMap<T>({
const el = document.createElement('div');
const markerOptions: MarkerOptions = {};
if (PinComponent) {
ReactDOM.render(<PinComponent result={result} index={i} />, el);
ReactDOM.render(<PinComponent
index={i}
mapbox={mapbox}
result={result}
/>, el);
markerOptions.element = el;
}
const marker = new Marker(markerOptions)
Expand Down
Loading