From 533023211eacfcdad01d9a7d13a9adc064c36a62 Mon Sep 17 00:00:00 2001 From: BFlat Date: Thu, 22 Feb 2024 11:27:16 +0700 Subject: [PATCH 1/8] fakeyou landing demo --- .../src/components/common/Button/Button.scss | 2 + .../src/components/common/Button/Button.tsx | 6 +- .../SelectionBubbles/SelectionBubbles.scss | 30 +++ .../SelectionBubbles/SelectionBubbles.tsx | 49 ++++ .../common/SelectionBubbles/index.tsx | 1 + .../common/TempTextArea/TempTextArea.tsx | 1 - .../components/common/TextArea/TextArea.scss | 31 +++ .../components/common/TextArea/TextArea.tsx | 27 +- .../src/components/common/index.tsx | 16 +- .../fakeyou.com/src/v2/view/PageContainer.tsx | 7 + .../src/v2/view/pages/landing/LandingPage.tsx | 18 ++ .../landing/fakeyou/FakeYouLandingDemo.tsx | 231 ++++++++++++++++++ .../landing/fakeyou/FakeYouLandingHeader.tsx | 188 +++++--------- 13 files changed, 457 insertions(+), 150 deletions(-) create mode 100644 packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.scss create mode 100644 packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx create mode 100644 packages/fakeyou.com/src/components/common/SelectionBubbles/index.tsx create mode 100644 packages/fakeyou.com/src/components/common/TextArea/TextArea.scss create mode 100644 packages/fakeyou.com/src/v2/view/pages/landing/fakeyou/FakeYouLandingDemo.tsx diff --git a/packages/fakeyou.com/src/components/common/Button/Button.scss b/packages/fakeyou.com/src/components/common/Button/Button.scss index 60d0a00c0c..fe4a74b99d 100644 --- a/packages/fakeyou.com/src/components/common/Button/Button.scss +++ b/packages/fakeyou.com/src/components/common/Button/Button.scss @@ -15,11 +15,13 @@ &-square { width: 46.5px; height: 46.5px; + padding: 0; } &-square-small { width: 37.5px; height: 37.5px; + padding: 0; } &:disabled, diff --git a/packages/fakeyou.com/src/components/common/Button/Button.tsx b/packages/fakeyou.com/src/components/common/Button/Button.tsx index c276f9214f..133ecf67e4 100644 --- a/packages/fakeyou.com/src/components/common/Button/Button.tsx +++ b/packages/fakeyou.com/src/components/common/Button/Button.tsx @@ -33,7 +33,9 @@ export default function Button({ const SpinnerComponent = isLoading ? (
Loading... @@ -59,7 +61,7 @@ export default function Button({ ) : ( <> - {IconComponent} + {isLoading ? null : IconComponent} {LabelComponent} {SpinnerComponent} diff --git a/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.scss b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.scss new file mode 100644 index 0000000000..ce8794debd --- /dev/null +++ b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.scss @@ -0,0 +1,30 @@ +@import "scss/colours.scss"; + +.selection-bubbles { + display: flex; + gap: 0.5rem; +} + +.bubble-button { + border: 2px solid darken($secondary, 3%); + padding: 8px 16px; + border-radius: 0.5rem; + background-color: darken($secondary, 3%); + cursor: pointer; + outline: none; + transition: all 0.2s ease; + font-size: 15px; + font-weight: 500; + color: rgba($white, 0.75); +} + +.bubble-button:hover { + background-color: $secondary; + border-color: $secondary; +} + +.bubble-button.selected { + color: $white; + border-color: $primary; + background-color: lighten($secondary, 6%); +} diff --git a/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx new file mode 100644 index 0000000000..5e5597bd0e --- /dev/null +++ b/packages/fakeyou.com/src/components/common/SelectionBubbles/SelectionBubbles.tsx @@ -0,0 +1,49 @@ +import React, { useEffect, useState } from "react"; +import "./SelectionBubbles.scss"; + +interface SelectionBubbleProps { + options: string[]; + onSelect: (selected: string) => void; +} + +export default function SelectionBubbles({ + options, + onSelect, +}: SelectionBubbleProps) { + //Select first one as default + const [selectedOption, setSelectedOption] = useState( + options.length > 0 ? options[0] : null + ); + + const handleSelect = ( + event: React.MouseEvent, + option: string + ) => { + event.preventDefault(); + setSelectedOption(option); + onSelect(option); + }; + + useEffect(() => { + if (selectedOption) { + onSelect(selectedOption); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( +
+ {options.map(option => ( + + ))} +
+ ); +} diff --git a/packages/fakeyou.com/src/components/common/SelectionBubbles/index.tsx b/packages/fakeyou.com/src/components/common/SelectionBubbles/index.tsx new file mode 100644 index 0000000000..b1f5697e45 --- /dev/null +++ b/packages/fakeyou.com/src/components/common/SelectionBubbles/index.tsx @@ -0,0 +1 @@ +export { default } from "./SelectionBubbles"; diff --git a/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx b/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx index 4b49ff2b87..73e70b29d8 100644 --- a/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx +++ b/packages/fakeyou.com/src/components/common/TempTextArea/TempTextArea.tsx @@ -15,7 +15,6 @@ export default function TempTextArea({ ...rest }: TextAreaProps) { return ( - // Changed fragment to div here just so that it can be laid out with bootstrap easily using d-flex, flex-column and responsive gaps which requires grouping.
{label && (