Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BrrePlace block + try nj add lightbox efect
- Loading branch information
Showing
10 changed files
with
229 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module '@fancyapps/ui/src/Fancybox/Fancybox.js' |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'react-lightbox-component' |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
/** | ||
* ФАЙЛ ГЕНЕРИРУЕТСЯ АВТОМАТИЧЕСКИ, ПРАВИТЬ ЕГО НЕ НУЖНО | ||
* Команда для генерирования этого файла: "yarn generate:types" | ||
*/ | ||
|
||
|
||
import * as Types from './types'; | ||
|
||
import { gql } from '@apollo/client'; | ||
import * as Apollo from '@apollo/client'; | ||
export type PlacesbeerQueryVariables = Types.Exact<{ | ||
where?: Types.Maybe<Types.PlaceWhereInput>; | ||
center?: Types.Maybe<Types.CoordsInput>; | ||
}>; | ||
|
||
|
||
export type PlacesbeerQuery = { __typename?: 'Query', mapPlacesConnection: { __typename?: 'MapPlaceConnection', edges: Array<{ __typename?: 'PlaceEdge', node: { __typename?: 'Place', id: string, uri?: Types.Maybe<string>, place_id?: Types.Maybe<number>, name: string, image?: Types.Maybe<string> } }> } }; | ||
|
||
|
||
export const PlacesbeerDocument = gql` | ||
query placesbeer($where: PlaceWhereInput, $center: CoordsInput) { | ||
mapPlacesConnection(first: 10, where: $where, center: $center) { | ||
edges { | ||
node { | ||
id | ||
uri | ||
place_id | ||
name | ||
image | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
/** | ||
* __usePlacesbeerQuery__ | ||
* | ||
* To run a query within a React component, call `usePlacesbeerQuery` and pass it any options that fit your needs. | ||
* When your component renders, `usePlacesbeerQuery` returns an object from Apollo Client that contains loading, error, and data properties | ||
* you can use to render your UI. | ||
* | ||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; | ||
* | ||
* @example | ||
* const { data, loading, error } = usePlacesbeerQuery({ | ||
* variables: { | ||
* where: // value for 'where' | ||
* center: // value for 'center' | ||
* }, | ||
* }); | ||
*/ | ||
export function usePlacesbeerQuery(baseOptions?: Apollo.QueryHookOptions<PlacesbeerQuery, PlacesbeerQueryVariables>) { | ||
return Apollo.useQuery<PlacesbeerQuery, PlacesbeerQueryVariables>(PlacesbeerDocument, baseOptions); | ||
} | ||
export function usePlacesbeerLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<PlacesbeerQuery, PlacesbeerQueryVariables>) { | ||
return Apollo.useLazyQuery<PlacesbeerQuery, PlacesbeerQueryVariables>(PlacesbeerDocument, baseOptions); | ||
} | ||
export type PlacesbeerQueryHookResult = ReturnType<typeof usePlacesbeerQuery>; | ||
export type PlacesbeerLazyQueryHookResult = ReturnType<typeof usePlacesbeerLazyQuery>; | ||
export type PlacesbeerQueryResult = Apollo.QueryResult<PlacesbeerQuery, PlacesbeerQueryVariables>; |
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from 'react' | ||
import { Paper, Grid } from '@material-ui/core' | ||
//import { imageFormats } from 'src/helpers/imageFormats' | ||
import Link from 'src/components/ui/Link' | ||
import { PlacesbeerViewProps } from './interfaces' | ||
|
||
import { | ||
usePlacesbeerQuery, | ||
PlacesbeerQueryVariables, | ||
} from 'src/modules/gql/generated' | ||
|
||
const BeerPlaces = (props: { beerid: number }) => { | ||
//console.log('this.props.beerid', props.beerid) | ||
|
||
const getVariables = (beerid: number): PlacesbeerQueryVariables => { | ||
return { | ||
where: { | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
beers_some: { | ||
Beer: { | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
beer_id: beerid, | ||
}, | ||
}, | ||
}, | ||
center: { | ||
lat: 55.752, | ||
lng: 37.621, | ||
}, | ||
} | ||
} | ||
|
||
const variables = getVariables(props.beerid) | ||
|
||
const response = usePlacesbeerQuery({ | ||
variables, | ||
}) | ||
|
||
//console.log('response', response.data) | ||
|
||
const places: PlacesbeerViewProps['places'] = [] | ||
|
||
response.data?.mapPlacesConnection.edges.forEach((n) => { | ||
if (n != null && n.node) { | ||
places.push(n.node) | ||
} | ||
}) | ||
|
||
//console.log('places', places) | ||
|
||
return ( | ||
<> | ||
<h2>Пивные места:</h2> | ||
<Paper style={{ padding: '15px' }}> | ||
<Grid container> | ||
{places.map((n) => { | ||
return n ? ( | ||
<> | ||
<Grid item xs={12} sm={6} md={4} lg={3}> | ||
<Link href={n.uri || '/'}>{n.name}</Link> | ||
</Grid> | ||
</> | ||
) : null | ||
})} | ||
</Grid> | ||
</Paper> | ||
</> | ||
) | ||
} | ||
|
||
export default BeerPlaces |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { PlacesbeerQuery } from 'src/modules/gql/generated' | ||
|
||
export type PlacesbeerViewProps = { | ||
places: PlacesbeerQuery | ||
} |
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