-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RC #121 - Upgrading dependencies for React, Webpack, Semantic UI; Rep…
…lacing react-xml-viewer component; Refactoring broken changes in components
- Loading branch information
1 parent
e93e8ff
commit 2aa48eb
Showing
11 changed files
with
40,369 additions
and
16,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
module.exports = { | ||
stories: [ | ||
'../stories/**/*.stories.js' | ||
], | ||
stories: ['../stories/**/*.stories.js'], | ||
addons: [ | ||
'@storybook/addon-a11y/register', | ||
'@storybook/addon-a11y', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-knobs/register', | ||
'@storybook/addon-knobs', | ||
'@storybook/addon-links' | ||
], | ||
core: { | ||
builder: "webpack5" | ||
} | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,49 @@ | ||
// @flow | ||
|
||
import React, { Component } from 'react'; | ||
import { withGoogleMap, withScriptjs } from 'react-google-maps'; | ||
import StandaloneSearchBox from 'react-google-maps/lib/components/places/StandaloneSearchBox'; | ||
import { LoadScript, StandaloneSearchBox } from '@react-google-maps/api'; | ||
import React, { Component, useCallback, useState } from 'react'; | ||
import _ from 'underscore'; | ||
import Google from '../utils/Google'; | ||
|
||
type Props = { | ||
children: Component<{}>, | ||
googleMapsApiKey: string, | ||
onLocationSelection: ({ lat: number, lng: number }) => void | ||
} | ||
|
||
const GooglePlacesSearchBox = (props: Props) => { | ||
const refs = {}; | ||
const GooglePlacesSearch = (props: Props) => { | ||
const [searchBox, setSearchBox] = useState(); | ||
|
||
const onPlacesChanged = () => { | ||
const place = _.first(refs.searchBox.getPlaces()); | ||
const { location } = place.geometry; | ||
const onPlacesChanged = useCallback(() => { | ||
if (searchBox) { | ||
const place = _.first(searchBox.getPlaces()); | ||
const { location } = place.geometry; | ||
|
||
const name = place.formatted_address; | ||
const lat = location.lat(); | ||
const lng = location.lng(); | ||
const name = place.formatted_address; | ||
const lat = location.lat(); | ||
const lng = location.lng(); | ||
|
||
props.onLocationSelection({ | ||
name, | ||
lat, | ||
lng, | ||
result: place | ||
}); | ||
}; | ||
props.onLocationSelection({ | ||
name, | ||
lat, | ||
lng, | ||
result: place | ||
}); | ||
} | ||
}, [searchBox, props.onLocationSelection]); | ||
|
||
return ( | ||
<StandaloneSearchBox | ||
ref={(searchBox) => { | ||
refs.searchBox = searchBox; | ||
}} | ||
onPlacesChanged={onPlacesChanged.bind(this)} | ||
<LoadScript | ||
googleMapsApiKey={props.googleMapsApiKey} | ||
libraries={['places']} | ||
> | ||
{ props.children } | ||
</StandaloneSearchBox> | ||
<StandaloneSearchBox | ||
onLoad={(s) => setSearchBox(s)} | ||
onPlacesChanged={onPlacesChanged} | ||
> | ||
{ props.children } | ||
</StandaloneSearchBox> | ||
</LoadScript> | ||
); | ||
}; | ||
|
||
const GooglePlacesSearchInput = withScriptjs(withGoogleMap(GooglePlacesSearchBox)); | ||
|
||
type WrapperProps = { | ||
children: Component<{}>, | ||
containerElement?: Component<{}>, | ||
googleMapsApiKey: string, | ||
loadingElement?: Component<{}>, | ||
mapElement?: Component<{}>, | ||
onLocationSelection: () => void, | ||
style?: any | ||
}; | ||
|
||
const GooglePlacesSearch = (props: WrapperProps) => ( | ||
<GooglePlacesSearchInput | ||
containerElement={props.containerElement} | ||
googleMapURL={Google.getGoogleMapsUrl(props.googleMapsApiKey)} | ||
loadingElement={props.loadingElement} | ||
mapElement={props.mapElement} | ||
onLocationSelection={props.onLocationSelection.bind(this)} | ||
style={props.style} | ||
> | ||
{ props.children } | ||
</GooglePlacesSearchInput> | ||
); | ||
|
||
GooglePlacesSearch.defaultProps = { | ||
containerElement: <div style={{ height: '100%' }} />, | ||
loadingElement: <div style={{ height: '100%' }} />, | ||
mapElement: <div style={{ height: '0px' }} />, | ||
style: { | ||
display: 'inline' | ||
} | ||
}; | ||
|
||
export default GooglePlacesSearch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +0,0 @@ | ||
.view-xml-modal .xml { | ||
background: #f4f4f4; | ||
border: 1px solid #ddd; | ||
color: #666; | ||
page-break-inside: avoid; | ||
font-family: monospace; | ||
font-size: 14px; | ||
line-height: 1.6; | ||
margin-bottom: 1.6em; | ||
max-width: 100%; | ||
overflow: auto; | ||
padding: 1em 1.5em; | ||
display: block; | ||
word-wrap: break-word; | ||
} | ||
Oops, something went wrong.