diff --git a/src/components/Feedback/Feedback.tsx b/src/components/Feedback/Feedback.tsx
index 7896b49bb..53a3ffa65 100644
--- a/src/components/Feedback/Feedback.tsx
+++ b/src/components/Feedback/Feedback.tsx
@@ -1,6 +1,6 @@
import { Stack } from '@mui/material';
import React, { useRef, useState } from 'react';
-import Button from '../Button';
+import Button from '../../design-system/components/Button';
import Box from '../Box';
import Badge from '../../design-system/components/Badge';
@@ -60,7 +60,14 @@ const Feedback = () => {
We'd be so grateful if you could take a moment to give us feedback on how we could make your experience even better.`}
/>
-
+
);
};
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
index f770c580b..c1db4472b 100644
--- a/src/components/Header/Header.tsx
+++ b/src/components/Header/Header.tsx
@@ -1,5 +1,6 @@
import React, { useCallback, useState } from 'react';
import { faBars, faComments } from '@fortawesome/free-solid-svg-icons';
+import Link from 'next/link';
import Box from '../Box';
import VisuallyHidden from '../VisuallyHidden';
@@ -10,7 +11,6 @@ import Logo from '../Logo';
import MainMenu from './MainMenu';
import { useMapState } from '../MapState';
import { useRouter } from 'next/router';
-import Button from '../Button';
import dynamic from 'next/dynamic';
import { useFeedbackPopover } from './hooks';
@@ -43,14 +43,14 @@ const Header = ({ children }) => {
minHeight={'60px'}
>
-
+
@@ -59,16 +59,12 @@ const Header = ({ children }) => {
-
{
flexDirection={['column', 'row']}
height={['100%', 'auto']}
width="100%"
+ alignItems="center"
>
Find a Toilet
@@ -76,7 +77,9 @@ const MainMenu = ({ children }: IMainMenu) => {
Feedback
@@ -86,7 +89,9 @@ const MainMenu = ({ children }: IMainMenu) => {
Feedback
diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx
index 7002e70fb..2972426bc 100644
--- a/src/components/Sidebar/Sidebar.tsx
+++ b/src/components/Sidebar/Sidebar.tsx
@@ -17,7 +17,7 @@ import Text from '../Text';
import Icon from '../Icon';
import LocationSearch from '../LocationSearch';
import Filters from '../Filters';
-import Button from '../Button';
+import Button from '../../design-system/components/Button';
import { useMapState } from '../MapState';
import config from '../../config';
import { usePlausible } from 'next-plausible';
@@ -117,9 +117,9 @@ const Sidebar = () => {
}
+ ref={filterToggleRef}
aria-expanded={isFiltersExpanded}
onClick={() => {
const stateText = isFiltersExpanded ? 'Close' : 'Open';
@@ -129,11 +129,13 @@ const Sidebar = () => {
aria-label="Filters Panel"
data-cy="mobile-filter"
>
- Filter
+
+ Filter mapState?.locationServices?.startLocate()}
@@ -175,6 +177,9 @@ const Sidebar = () => {
{
setIsFiltersExpanded(false);
diff --git a/src/components/ToiletDetailsPanel.tsx b/src/components/ToiletDetailsPanel.tsx
index 812652ab4..07b4ba943 100644
--- a/src/components/ToiletDetailsPanel.tsx
+++ b/src/components/ToiletDetailsPanel.tsx
@@ -19,10 +19,11 @@ import Link from 'next/link';
import { Loo } from '../api-client/graphql';
import Box from './Box';
-import Button from './Button';
import Text from './Text';
import Spacer from './Spacer';
import Icon from './Icon';
+import Badge from '../design-system/components/Badge';
+import Button from '../design-system/components/Button';
import { Media } from './Media';
// Suppress Opening Hours Heading during COVID-19
import { WEEKDAYS, getTimeRangeLabel } from '../lib/openingTimes';
@@ -31,7 +32,6 @@ import type L from 'leaflet';
import { useRouter } from 'next/router';
import { useSubmitVerificationReportMutationMutation } from '../api-client/graphql';
import { usePlausible } from 'next-plausible';
-import Badge from '../design-system/components/Badge';
import { getFeatures } from '../lib/features';
const Grid = styled(Box)`
@@ -167,26 +167,18 @@ const ToiletDetailsPanel: React.FC = ({
);
const getDirectionsFragment = (
-
-
-
-
-
- Directions
-
-
+
+ Directions
+
);
const openingTimes = data.openingTimes || WEEKDAYS.map(() => null);
@@ -221,6 +213,8 @@ const ToiletDetailsPanel: React.FC = ({
{
plausible('Verification Report');
submitVerificationReportMutation({
@@ -230,25 +224,24 @@ const ToiletDetailsPanel: React.FC = ({
}}
disabled={verificationReportState.loading === true}
>
- Yes
+ Yes
{verificationReportState.loading === true && (
-
-
-
+
)}
No?
-
-
-
-
-
- Edit
-
-
+
+
+ Edit
+
@@ -442,10 +435,8 @@ const ToiletDetailsPanel: React.FC = ({
Hours may vary with national holidays or seasonal changes. If
you know these hours to be out of date please{' '}
-
-
- edit this toilet
-
+
+ edit this toilet
.
@@ -464,9 +455,7 @@ const ToiletDetailsPanel: React.FC = ({
padding={2}
marginBottom={2}
>
-
- Back to top
-
+ Back to top
@@ -523,23 +512,27 @@ const ToiletDetailsPanel: React.FC = ({
{getDirectionsFragment}
}
onClick={() => setIsExpanded(true)}
aria-expanded="false"
data-testid="details-button"
>
- Details
+
+ Details}
+ htmlElement="button"
+ type="button"
onClick={navigateAway}
aria-expanded="false"
data-testid="close-button"
>
- Close
+
+ Close
diff --git a/src/design-system/components/Button/Button.css b/src/design-system/components/Button/Button.css
new file mode 100644
index 000000000..4c56b3d72
--- /dev/null
+++ b/src/design-system/components/Button/Button.css
@@ -0,0 +1,48 @@
+.button {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+ user-select: none;
+ min-height: 34px;
+ max-width: 300px;
+ border-radius: 17px;
+ padding: 0 var(--space-s);
+ border-style: solid;
+ border-width: 2px;
+ border-color: var(--color-turquoise);
+ color: var(--color-blue);
+ font-weight: bold;
+ background-color: var(--color-turquoise);
+}
+
+.button > * + * {
+ margin-left: var(--space-2xs);
+}
+
+.button:disabled {
+ border-color: var(--color-light-grey);
+ background-color: var(--color-light-grey);
+}
+
+.button:disabled:hover {
+ color: var(--color-blue);
+ cursor: not-allowed;
+}
+
+.button:not(:disabled):hover,
+.button:not(:disabled):focus {
+ color: var(--color-turquoise);
+ background-color: var(--color-blue);
+ border-color: var(--color-blue);
+}
+
+.button--secondary {
+ background-color: var(--color-white);
+ border-color: var(--color-blue);
+}
+
+.button--secondary:not(:disabled):hover,
+.button--secondary:not(:disabled):focus {
+ color: var(--color-white);
+}
diff --git a/src/design-system/components/Button/Button.stories.tsx b/src/design-system/components/Button/Button.stories.tsx
new file mode 100644
index 000000000..e4dfe734d
--- /dev/null
+++ b/src/design-system/components/Button/Button.stories.tsx
@@ -0,0 +1,31 @@
+import { ComponentStory, ComponentMeta } from '@storybook/react';
+
+import Button from './Button';
+
+export default {
+ title: 'Design-System/Button',
+ component: Button,
+ argTypes: {
+ children: { table: { disable: true } },
+ variant: { table: { disable: true } },
+ },
+ args: { href: 'www.google.com' },
+} as ComponentMeta;
+
+const Template: ComponentStory = (args) => ;
+
+export const Primary = Template.bind({});
+
+Primary.args = {
+ children: Primary button,
+ variant: 'primary',
+ htmlElement: 'button',
+};
+
+export const Secondary = Template.bind({});
+
+Secondary.args = {
+ children: 'Secondary button',
+ variant: 'secondary',
+ htmlElement: 'button',
+};
diff --git a/src/design-system/components/Button/Button.tsx b/src/design-system/components/Button/Button.tsx
new file mode 100644
index 000000000..4dee1f2f7
--- /dev/null
+++ b/src/design-system/components/Button/Button.tsx
@@ -0,0 +1,35 @@
+import Link from 'next/link';
+
+import { ButtonProps } from './Button.types';
+import { forwardRef } from 'react';
+
+const Button = forwardRef((props, ref) => {
+ if (props.htmlElement === 'a') {
+ return (
+
+ {props.children}
+
+ );
+ }
+ return (
+
+ {props.children}
+
+ );
+});
+
+Button.displayName = 'Button';
+
+export default Button;
diff --git a/src/design-system/components/Button/Button.types.tsx b/src/design-system/components/Button/Button.types.tsx
new file mode 100644
index 000000000..1f1fd8f03
--- /dev/null
+++ b/src/design-system/components/Button/Button.types.tsx
@@ -0,0 +1,14 @@
+interface Button extends React.ButtonHTMLAttributes {
+ htmlElement: 'button';
+ variant: 'primary' | 'secondary';
+ children: React.ReactNode;
+}
+
+interface Link extends React.AnchorHTMLAttributes {
+ htmlElement: 'a';
+ variant: 'primary' | 'secondary';
+ children: React.ReactNode;
+ href: string;
+}
+
+export type ButtonProps = Link | Button;
diff --git a/src/components/Button/index.ts b/src/design-system/components/Button/index.tsx
similarity index 100%
rename from src/components/Button/index.ts
rename to src/design-system/components/Button/index.tsx
diff --git a/src/design-system/components/stylesheet.css b/src/design-system/components/stylesheet.css
new file mode 100644
index 000000000..f5105cac9
--- /dev/null
+++ b/src/design-system/components/stylesheet.css
@@ -0,0 +1,2 @@
+@import 'src/design-system/components/Badge/Badge.css';
+@import 'src/design-system/components/Button/Button.css';
diff --git a/src/pages/404.page.tsx b/src/pages/404.page.tsx
index 34cc09a69..d3734928e 100644
--- a/src/pages/404.page.tsx
+++ b/src/pages/404.page.tsx
@@ -1,8 +1,9 @@
import React from 'react';
+import Link from 'next/link';
+
import Box from '../components/Box';
import Spacer from '../components/Spacer';
import Text from '../components/Text';
-import Button from '../components/Button';
const NotFound = ({ children }) => (
<>
@@ -31,9 +32,7 @@ const NotFound = ({ children }) => (
-
- Take me back home!
-
+ Take me back home!
diff --git a/src/pages/500.page.tsx b/src/pages/500.page.tsx
index 9887d1717..44ddf2a51 100644
--- a/src/pages/500.page.tsx
+++ b/src/pages/500.page.tsx
@@ -1,8 +1,9 @@
import React from 'react';
+import Link from 'next/link';
+
import Box from '../components/Box';
import Spacer from '../components/Spacer';
import Text from '../components/Text';
-import Button from '../components/Button';
const ThereWasAProblem = ({ children }) => (
<>
@@ -27,17 +28,15 @@ const ThereWasAProblem = ({ children }) => (
Please try again later or, if the problem persists, please contact
us at{' '}
-
+
gbtoiletmap@gmail.com
-
+
.
-
- Take me back home!
-
+ Take me back home!
diff --git a/src/pages/_app.page.tsx b/src/pages/_app.page.tsx
index f303ed753..ef054b014 100644
--- a/src/pages/_app.page.tsx
+++ b/src/pages/_app.page.tsx
@@ -9,7 +9,7 @@ import '@fortawesome/fontawesome-svg-core/styles.css';
config.autoAddCss = false; // Tell Font Awesome to skip adding the CSS automatically since it's being imported above
import { useRouter } from 'next/router';
import LooMap from '../components/LooMap/LooMapLoader';
-import '../design-system/components/Badge/Badge.css';
+import '../design-system/components/stylesheet.css';
const App = (props) => {
const router = useRouter();
diff --git a/src/pages/about.page.tsx b/src/pages/about.page.tsx
index eaea0f63e..d97bdf0f7 100644
--- a/src/pages/about.page.tsx
+++ b/src/pages/about.page.tsx
@@ -3,7 +3,7 @@ import Link from 'next/link';
import Head from 'next/head';
import styled from '@emotion/styled';
import Container from '../components/Container';
-import Button from '../components/Button';
+import Button from '../design-system/components/Button';
import Text, { TextProps } from '../components/Text';
import Spacer from '../components/Spacer';
import Box, { BoxProps } from '../components/Box';
@@ -56,34 +56,25 @@ const AboutPage = () => {
joint venture between researchers Dr Jo-Anne Bichard and Gail Ramster
(who created the map at the RCA Helen Hamlyn Centre for Design) and
software development company{' '}
-
-
- Neontribe
-
+
+ Neontribe
{' '}
(who designed and built it).
The information comes from the public - anyone can go on the website
- and{' '}
-
- add, edit or remove toilets
-
- . We also use open data and request information from councils,{' '}
-
-
- OpenStreetMap
-
+ and add, edit or remove toilets. We also use
+ open data and request information from councils,{' '}
+
+ OpenStreetMap
, private companies and organisations.
@@ -94,20 +85,15 @@ const AboutPage = () => {
to download below.
-
-
- Download volunteer help guide
-
-
+ Download volunteer help guide
+
A handy printable checklist designed to make it easier for you to
@@ -115,16 +101,15 @@ const AboutPage = () => {
also available for download.
The project aims to map all publicly-accessible toilets - that means
@@ -163,19 +148,13 @@ const AboutPage = () => {
If you have any problems updating the toilets, or wish to send us
toilet details or comments, please contact{' '}
-
-
- gbtoiletmap@gmail.com
-
-
+ gbtoiletmap@gmail.com
.
The Explorer
-
-
- Visit the Explorer
-
+
+ Visit the Explorer
to get an overview of the statistics and details related to the
Toilet Map. These statistics are calculated on-demand, so will be up
diff --git a/src/pages/contact.page.tsx b/src/pages/contact.page.tsx
index 54808a76a..030f82cc3 100644
--- a/src/pages/contact.page.tsx
+++ b/src/pages/contact.page.tsx
@@ -1,11 +1,12 @@
import Head from 'next/head';
+import Link from 'next/link';
+import { NextPage } from 'next';
+
import Container from '../components/Container';
-import Button from '../components/Button';
import Text from '../components/Text';
import Spacer from '../components/Spacer';
import Box from '../components/Box';
import config from '../config';
-import { NextPage } from 'next';
const ContactPage = () => {
return (
@@ -22,9 +23,7 @@ const ContactPage = () => {
If you have any problems updating the toilets, or wish to send us
toilet details or comments, please contact{' '}
-
- gbtoiletmap@gmail.com
-
+ gbtoiletmap@gmail.com
.
diff --git a/src/pages/explorer/search.page.tsx b/src/pages/explorer/search.page.tsx
index 049f22860..1ad247130 100644
--- a/src/pages/explorer/search.page.tsx
+++ b/src/pages/explorer/search.page.tsx
@@ -12,7 +12,7 @@ import Spacer from '../../components/Spacer';
import Box from '../../components/Box';
import styled from '@emotion/styled';
import { useRouter } from 'next/router';
-import Button from '../../components/Button';
+import Button from '../../design-system/components/Button';
import { css } from '@emotion/react';
import theme from '../../theme';
import Link from 'next/link';
@@ -246,7 +246,7 @@ const UnstyledTable = () => {
}
>
-
+
Search
diff --git a/src/pages/login.page.tsx b/src/pages/login.page.tsx
index 806fe22ca..f2a5d9526 100644
--- a/src/pages/login.page.tsx
+++ b/src/pages/login.page.tsx
@@ -1,14 +1,15 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import styled from '@emotion/styled';
+import Link from 'next/link';
+
import Container from '../components/Container';
-import Button from '../components/Button';
+import Button from '../design-system/components/Button';
import Text from '../components/Text';
import Spacer from '../components/Spacer';
import Box, { BoxProps } from '../components/Box';
import config from '../config';
-import Link from 'next/link';
const List = styled.ul`
list-style: initial;
@@ -40,14 +41,14 @@ const LoginPage = () => {
Up:
-
-
- Log In/Sign Up
-
-
+ >
+ Log In/Sign Up
+
Examples of Public toilets
@@ -91,9 +92,7 @@ const LoginPage = () => {
If you have any problems updating the toilets, or wish to send us
toilet details or comments, please contact{' '}
-
- gbtoiletmap@gmail.com
-
+ gbtoiletmap@gmail.com
.
diff --git a/src/pages/loos/[id]/edit.page.tsx b/src/pages/loos/[id]/edit.page.tsx
index 35178c03f..5a50412ff 100644
--- a/src/pages/loos/[id]/edit.page.tsx
+++ b/src/pages/loos/[id]/edit.page.tsx
@@ -1,10 +1,10 @@
import React from 'react';
-
import Head from 'next/head';
-import Link from 'next/link';
-
import { useUser } from '@auth0/nextjs-auth0';
-import Button from '../../../components/Button';
+import { useEffect } from 'react';
+import { css } from '@emotion/react';
+
+import Button from '../../../design-system/components/Button';
import Spacer from '../../../components/Spacer';
import EntryForm from '../../../components/EntryForm';
import Box from '../../../components/Box';
@@ -22,9 +22,7 @@ import {
UpdateLooMutationVariables,
useUpdateLooMutation,
} from '../../../api-client/graphql';
-import { useEffect } from 'react';
import LocationSearch from '../../../components/LocationSearch';
-import { css } from '@emotion/react';
import NotFound from '../../404.page';
const EditPage: PageFindLooByIdComp | React.FC<{ notFound?: boolean }> = (
@@ -158,10 +156,9 @@ const EditPage: PageFindLooByIdComp | React.FC<{ notFound?: boolean }> = (
>
Update the toilet
@@ -170,11 +167,9 @@ const EditPage: PageFindLooByIdComp | React.FC<{ notFound?: boolean }> = (
Remove the toilet
diff --git a/src/pages/loos/[id]/remove.page.tsx b/src/pages/loos/[id]/remove.page.tsx
index 57a775685..b95ae8f70 100644
--- a/src/pages/loos/[id]/remove.page.tsx
+++ b/src/pages/loos/[id]/remove.page.tsx
@@ -8,7 +8,7 @@ import Container from '../../../components/Container';
import Box from '../../../components/Box';
import Spacer from '../../../components/Spacer';
import Text from '../../../components/Text';
-import Button from '../../../components/Button';
+import Button from '../../../design-system/components/Button';
import Notification from '../../../components/Notification';
import Login from '../../login.page';
import PageLoading from '../../../components/PageLoading';
@@ -153,7 +153,9 @@ const RemovePage: PageFindLooByIdComp | React.FC<{ notFound?: boolean }> =
- Remove
+
+ Remove
+
{loadingRemove && (
diff --git a/src/pages/loos/add.page.tsx b/src/pages/loos/add.page.tsx
index b5ec55e3a..5d62d8645 100644
--- a/src/pages/loos/add.page.tsx
+++ b/src/pages/loos/add.page.tsx
@@ -5,7 +5,7 @@ import { useUser } from '@auth0/nextjs-auth0';
import EntryForm from '../../components/EntryForm';
import Box from '../../components/Box';
import Spacer from '../../components/Spacer';
-import Button from '../../components/Button';
+import Button from '../../design-system/components/Button';
import LocationSearch from '../../components/LocationSearch';
import Login from '../login.page';
@@ -119,7 +119,12 @@ const AddPage = () => {
onSubmit={saveLoo}
>
-
+
Save toilet
diff --git a/src/pages/privacy.page.tsx b/src/pages/privacy.page.tsx
index b8e9fac07..14dfc3557 100644
--- a/src/pages/privacy.page.tsx
+++ b/src/pages/privacy.page.tsx
@@ -1,9 +1,9 @@
import Head from 'next/head';
+import Link from 'next/link';
import Container from '../components/Container';
import Text from '../components/Text';
import Spacer from '../components/Spacer';
-import Button from '../components/Button';
import Box from '../components/Box';
import config from '../config';
@@ -72,15 +72,13 @@ const PrivacyPage = () => {
If you'd like to know what we've stored about you, or ask us
to forget you, or to let us know about something you'd like
changed please drop us a line at{' '}
-
gbtoiletmap@gmail.com
-
+
. If you'd like to exercise any of your rights under the GDPR
that's the address to use.