-
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.
Merge pull request #632 from CodeForAfrica/feature/our-addresses
Code for Africa Our offices
- Loading branch information
Showing
10 changed files
with
157 additions
and
15 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,35 @@ | ||
function ourOffices(block) { | ||
const { offices } = block; | ||
const addresses = | ||
offices?.map((item) => { | ||
let location = null; | ||
if (item?.location?.length) { | ||
location = { | ||
lng: item?.location?.[0], | ||
lat: item?.location?.[1], | ||
}; | ||
} | ||
return { | ||
...item, | ||
position: location, | ||
center: location, | ||
}; | ||
}) ?? null; | ||
return { | ||
...block, | ||
slug: block.blockType, | ||
addresses, | ||
map: { | ||
apiKey: process.env.GOOGLE_API_KEY ?? null, | ||
zoom: 20, | ||
zoomControl: false, | ||
mapTypeControl: false, | ||
scaleControl: false, | ||
streetViewControl: false, | ||
rotateControl: false, | ||
fullscreenControl: false, | ||
}, | ||
}; | ||
} | ||
|
||
export default ourOffices; |
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,21 @@ | ||
const OurOffices = { | ||
slug: "our-offices", | ||
imageURL: "/images/cms/blocks/our_offices.png", | ||
imageAltText: "Our offices", | ||
fields: [ | ||
{ | ||
name: "title", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
hasMany: true, | ||
type: "relationship", | ||
relationTo: "offices", | ||
name: "offices", | ||
required: true, | ||
}, | ||
], | ||
}; | ||
|
||
export default OurOffices; |
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,42 @@ | ||
import { allCountries } from "../../lib/data/json/countries"; | ||
|
||
const Offices = { | ||
slug: "offices", | ||
admin: { | ||
group: "Organisation", | ||
defaultColumns: ["city", "country"], | ||
useAsTitle: "city", | ||
}, | ||
fields: [ | ||
{ | ||
name: "city", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
name: "location", | ||
type: "point", | ||
label: "Location", | ||
required: true, | ||
}, | ||
{ | ||
name: "addressLine1", | ||
type: "text", | ||
}, | ||
{ | ||
name: "addressLine2", | ||
type: "text", | ||
}, | ||
{ | ||
name: "zipCode", | ||
type: "text", | ||
}, | ||
{ | ||
name: "country", | ||
type: "select", | ||
options: allCountries, | ||
}, | ||
], | ||
}; | ||
|
||
export default Offices; |
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