From 160727c0e25363e5fd0557420b2eb78adaf2b611 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Wed, 25 Aug 2021 11:18:37 +0100 Subject: [PATCH] Extracted PhoneInput, fixed styling (#520) --- components/ui/form/PhoneInput.tsx | 19 ++++++++++++++++++ pages/[user]/book.tsx | 16 +++------------- styles/globals.css | 32 ++++++++++++++++++++----------- 3 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 components/ui/form/PhoneInput.tsx diff --git a/components/ui/form/PhoneInput.tsx b/components/ui/form/PhoneInput.tsx new file mode 100644 index 0000000000..d6db512ab1 --- /dev/null +++ b/components/ui/form/PhoneInput.tsx @@ -0,0 +1,19 @@ +import "react-phone-number-input/style.css"; +import { default as BasePhoneInput } from "react-phone-number-input"; +import React from "react"; +import classNames from "@lib/classNames"; + +export const PhoneInput = (props) => ( + { + /* DO NOT REMOVE: Callback required by PhoneInput, comment added to satisfy eslint:no-empty-function */ + }} + /> +); + +export default PhoneInput; diff --git a/pages/[user]/book.tsx b/pages/[user]/book.tsx index bf4c9f64a4..e74e796af4 100644 --- a/pages/[user]/book.tsx +++ b/pages/[user]/book.tsx @@ -9,8 +9,7 @@ import { useEffect, useState } from "react"; import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; import timezone from "dayjs/plugin/timezone"; -import "react-phone-number-input/style.css"; -import PhoneInput from "react-phone-number-input"; +import PhoneInput from "@components/ui/form/PhoneInput"; import { LocationType } from "../../lib/location"; import Avatar from "@components/Avatar"; import { Button } from "@components/ui/Button"; @@ -255,19 +254,10 @@ export default function Book(props: any): JSX.Element {
- { - /* DO NOT REMOVE: Callback required by PhoneInput, comment added to satisfy eslint:no-empty-function */ - }} - /> +
)} diff --git a/styles/globals.css b/styles/globals.css index 93ea43aa17..e3eb4577a9 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -2,6 +2,16 @@ @tailwind components; @tailwind utilities; +/* PhoneInput dark-mode overrides (it would add a lot of boilerplate to do this in JavaScript) */ +.PhoneInputInput { + @apply text-sm focus:ring-0 border-0; +} +.dark .PhoneInputInput { + @apply bg-black; +} +.PhoneInputCountrySelect { + @apply text-black; +} /* note(PeerRich): TODO move @layer components into proper React Components: