Skip to content

Commit

Permalink
chore(docs): install and document leaflet docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaye committed Mar 19, 2021
1 parent 74b32e3 commit 4470e61
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
22 changes: 20 additions & 2 deletions docs/components/contacts-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
title: Contact block
---

import PreviewArea from "../../src/PreviewArea"

## With a map

<PreviewArea>

<section class="lbh-contact">
<h2 class="lbh-heading-large-light lbh-contact__title">Service Name Centre</h2>
<div class="lbh-contact__social">
Expand Down Expand Up @@ -110,6 +114,20 @@ title: Contact block
</div>
</section>

</PreviewArea>

### Include Leaflet Sass and JS

Maps in the contact block require [Leaflet](https://leafletjs.com), which you can install with `npm leaflet` and then add the Sass and JavaScript to your app:

```js
import L from "leaflet";
```

```scss
@import "../node_modules/leaflet/dist/leaflet.css";
```

### HTML

```html
Expand Down Expand Up @@ -368,7 +386,7 @@ title: Contact block
<div class="lbh-contact__details">
<div class="lbh-contact__block">
<h4 class="lbh-heading-h4 lbh-contact__block-title lbh-contact__block-title--telephone">Telephone</h4>
<a href="tel:" class="lbh-contact__telephone" title="Call us on"></a>
<a href="tel:" class="lbh-contact__telephone" title="Call us on "></a>
</div>
<div class="lbh-contact__block">
<h4 class="lbh-heading-h4 lbh-contact__block-title lbh-contact__block-title--email">Email</h4>
Expand Down Expand Up @@ -396,7 +414,7 @@ title: Contact block
>
Telephone
</h4>
<a href="tel:" class="lbh-contact__telephone" title="Call us on"></a>
<a href="tel:" class="lbh-contact__telephone" title="Call us on "></a>
</div>
<div class="lbh-contact__block">
<h4
Expand Down
18 changes: 7 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"dependencies": {
"govuk-frontend": "^3.11.0",
"leaflet": "^1.7.1",
"underscore": "^1.9.1"
},
"sasslintConfig": "config/.sass-lint.yml",
Expand Down
2 changes: 2 additions & 0 deletions src/docs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import L from "leaflet";

if (typeof window !== "undefined") {
document.body.className = document.body.className
? document.body.className + " js-enabled"
Expand Down
4 changes: 3 additions & 1 deletion src/docs.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../node_modules/leaflet/dist/leaflet.css";

/* stylelint-disable docusaurus/copyright-header */
/**
* Any CSS included here will be global. The classic template
Expand Down Expand Up @@ -60,7 +62,7 @@ html[data-theme="dark"] .hero img {
}
}

.colour-preview{
.colour-preview {
height: 35px;
width: 35px;
border-radius: 100%;
Expand Down

0 comments on commit 4470e61

Please sign in to comment.