From c53dda317d1610afaf3a21623df0435df69c175d Mon Sep 17 00:00:00 2001 From: Sebastian-ubs <141921979+Sebastian-ubs@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:02:45 +0200 Subject: [PATCH] add explanations to preview app (#1121) * add explanations to preview app * add a little more styling * remove unneeded comment --- .../src/preview/app.component.tsx | 7 +++-- .../pages/components/advanced.component.tsx | 15 ++++------- .../pages/components/basics.component.tsx | 5 +++- .../basics/alert.examples.component.tsx | 4 +-- .../basics/button.examples.component.tsx | 11 ++++---- .../basics/card.examples.component.tsx | 4 +-- .../basics/checkbox.examples.component.tsx | 5 ++-- .../src/preview/pages/guide.component.tsx | 7 ++++- .../pages/guide/direction.guide.component.tsx | 5 ++-- .../preview/pages/guide/howto.component.tsx | 24 +++++++++++++++++ .../contact-buttons.component.tsx | 27 +++++++++++++++++++ ...gle.tsx => direction-toggle.component.tsx} | 1 + .../discord-logo.component.tsx | 17 ++++++++++++ .../theme-toggle.component.tsx | 2 ++ 14 files changed, 106 insertions(+), 28 deletions(-) create mode 100644 lib/platform-bible-react/src/preview/pages/guide/howto.component.tsx create mode 100644 lib/platform-bible-react/src/preview/preview-components/contact-buttons.component.tsx rename lib/platform-bible-react/src/preview/preview-components/{direction-toggle.tsx => direction-toggle.component.tsx} (95%) create mode 100644 lib/platform-bible-react/src/preview/preview-components/discord-logo.component.tsx diff --git a/lib/platform-bible-react/src/preview/app.component.tsx b/lib/platform-bible-react/src/preview/app.component.tsx index c6cc3555b1..6989fc8b86 100644 --- a/lib/platform-bible-react/src/preview/app.component.tsx +++ b/lib/platform-bible-react/src/preview/app.component.tsx @@ -5,9 +5,10 @@ import Basics from './pages/components/basics.component'; import Guide from './pages/guide.component'; import Layouts from './pages/layouts.component'; import Playground from './pages/playground.component'; -import { DirToggle, Direction } from './preview-components/direction-toggle'; +import { DirToggle, Direction } from './preview-components/direction-toggle.component'; import { ThemeProvider } from './preview-components/theme-provider.component'; import { ThemeButton } from './preview-components/theme-toggle.component'; +import ContactButtons from './preview-components/contact-buttons.component'; function App() { const [direction, setDirection] = useState('ltr'); @@ -20,8 +21,10 @@ function App() { +
+ +

platform-bible-react Preview

-

Edit lib/platform-bible-react/src/preview/components/... and save to see updates

Basic Components diff --git a/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx b/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx index b4dd87df23..12573e9781 100644 --- a/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/advanced.component.tsx @@ -74,18 +74,17 @@ function Compositions({ direction }: HasDirection) { Book Chapter Control - - Scroll Group Selector - - Theme Toggle Data Table - Marketplace - Result List Inventory + Marketplace Navigation Content Search + Result List Settings Components + + Scroll Group Selector + @@ -102,10 +101,6 @@ function Compositions({ direction }: HasDirection) {
Scroll Group Id: {`${scrollGroupId}`}
- - - - diff --git a/lib/platform-bible-react/src/preview/pages/components/basics.component.tsx b/lib/platform-bible-react/src/preview/pages/components/basics.component.tsx index 79b3a710e8..efce6bbede 100644 --- a/lib/platform-bible-react/src/preview/pages/components/basics.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/basics.component.tsx @@ -67,7 +67,10 @@ function Basics({ direction }: HasDirection) { - alert(`you searched for ${search}`)} /> ← type here +
+ alert(`you searched for ${search}`)} />{' '} + {direction === 'rtl' ? <>→ : <>←} type here +
diff --git a/lib/platform-bible-react/src/preview/pages/components/basics/alert.examples.component.tsx b/lib/platform-bible-react/src/preview/pages/components/basics/alert.examples.component.tsx index 865ff4ae24..0225d98506 100644 --- a/lib/platform-bible-react/src/preview/pages/components/basics/alert.examples.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/basics/alert.examples.component.tsx @@ -3,7 +3,7 @@ import { AlertCircle, Terminal } from 'lucide-react'; export default function ExampleAlerts() { return ( - <> +
Heads up! @@ -24,6 +24,6 @@ export default function ExampleAlerts() { Alert! With nothing else in it, this looks like a Card 🤔 - +
); } diff --git a/lib/platform-bible-react/src/preview/pages/components/basics/button.examples.component.tsx b/lib/platform-bible-react/src/preview/pages/components/basics/button.examples.component.tsx index 2a2af68f99..86225130a9 100644 --- a/lib/platform-bible-react/src/preview/pages/components/basics/button.examples.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/basics/button.examples.component.tsx @@ -5,10 +5,11 @@ export default function ButtonExamples() { - - + - +
variant - - + variant + @@ -17,7 +18,7 @@ export default function ButtonExamples() {
sizesize default: diff --git a/lib/platform-bible-react/src/preview/pages/components/basics/card.examples.component.tsx b/lib/platform-bible-react/src/preview/pages/components/basics/card.examples.component.tsx index 467c00c224..ef46b69350 100644 --- a/lib/platform-bible-react/src/preview/pages/components/basics/card.examples.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/basics/card.examples.component.tsx @@ -27,7 +27,7 @@ export default function CardExamples({ direction }: HasDirection) { ); return ( - <> +
Card only @@ -99,6 +99,6 @@ export default function CardExamples({ direction }: HasDirection) { - +
); } diff --git a/lib/platform-bible-react/src/preview/pages/components/basics/checkbox.examples.component.tsx b/lib/platform-bible-react/src/preview/pages/components/basics/checkbox.examples.component.tsx index 94f47453a4..a4318edf21 100644 --- a/lib/platform-bible-react/src/preview/pages/components/basics/checkbox.examples.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/components/basics/checkbox.examples.component.tsx @@ -3,9 +3,8 @@ import { Label } from '@/components/shadcn-ui/label'; export default function CheckboxExamples() { return ( - <> +

Note: that the bug of checkboxes jumping up and down is already coming from Shadcn

-
- +
); } diff --git a/lib/platform-bible-react/src/preview/pages/guide.component.tsx b/lib/platform-bible-react/src/preview/pages/guide.component.tsx index 18008fc8c6..39f805a482 100644 --- a/lib/platform-bible-react/src/preview/pages/guide.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/guide.component.tsx @@ -9,6 +9,7 @@ import { DirectionProps } from '@/preview/preview-components/direction-toggle'; import DirectionGuide from './guide/direction.guide.component'; import ThemeColorDisplay from './guide/theme-color-display.component'; import ThemingGuide from './guide/theming.guide.component'; +import HowToGuide from './guide/howto.component'; function Guide({ direction, onChangeDirection: setDirection }: DirectionProps) { return ( @@ -16,13 +17,17 @@ function Guide({ direction, onChangeDirection: setDirection }: DirectionProps) {

A place to look up and learn about some concepts

- + + How to use Direction Theming Current Theme Colors + + + diff --git a/lib/platform-bible-react/src/preview/pages/guide/direction.guide.component.tsx b/lib/platform-bible-react/src/preview/pages/guide/direction.guide.component.tsx index d00093930e..3bf18c8d1f 100644 --- a/lib/platform-bible-react/src/preview/pages/guide/direction.guide.component.tsx +++ b/lib/platform-bible-react/src/preview/pages/guide/direction.guide.component.tsx @@ -1,7 +1,7 @@ import { History } from 'lucide-react'; import { Button } from '@/components/shadcn-ui/button'; import { Input } from '@/components/shadcn-ui/input'; -import { DirectionProps, DirToggle } from '@/preview/preview-components/direction-toggle'; +import { DirectionProps, DirToggle } from '@/preview/preview-components/direction-toggle.component'; export default function DirectionGuide({ direction, @@ -94,10 +94,11 @@ export default function DirectionGuide({ Good: pr-text-end

Another bad example

+

In left-to-right the icon should appear at the left

diff --git a/lib/platform-bible-react/src/preview/pages/guide/howto.component.tsx b/lib/platform-bible-react/src/preview/pages/guide/howto.component.tsx new file mode 100644 index 0000000000..c3b4f6cf37 --- /dev/null +++ b/lib/platform-bible-react/src/preview/pages/guide/howto.component.tsx @@ -0,0 +1,24 @@ +export default function HowToGuide() { + return ( + <> +

+ To make changes to this preview edit files under{' '} + lib/platform-bible-react/src/preview/pages. On saving a file your changes will + show up immediately. +

+
+

+ For detailed explanation what to consider for developing components see{' '} + + the component creation page + {' '} + in the wiki. +

+ + ); +} diff --git a/lib/platform-bible-react/src/preview/preview-components/contact-buttons.component.tsx b/lib/platform-bible-react/src/preview/preview-components/contact-buttons.component.tsx new file mode 100644 index 0000000000..3f95b6d7b8 --- /dev/null +++ b/lib/platform-bible-react/src/preview/preview-components/contact-buttons.component.tsx @@ -0,0 +1,27 @@ +import { Button } from '@/components/shadcn-ui/button'; +import { Mail } from 'lucide-react'; +import DiscordLogo from './discord-logo.component'; + +export default function ContactButtons() { + return ( + <> + Get in contact with the UX Team + + + + + + ); +} diff --git a/lib/platform-bible-react/src/preview/preview-components/direction-toggle.tsx b/lib/platform-bible-react/src/preview/preview-components/direction-toggle.component.tsx similarity index 95% rename from lib/platform-bible-react/src/preview/preview-components/direction-toggle.tsx rename to lib/platform-bible-react/src/preview/preview-components/direction-toggle.component.tsx index 7f837d53cc..5917f80ca2 100644 --- a/lib/platform-bible-react/src/preview/preview-components/direction-toggle.tsx +++ b/lib/platform-bible-react/src/preview/preview-components/direction-toggle.component.tsx @@ -17,6 +17,7 @@ export const DirToggle = React.forwardRef { changeDirection(oppositeDirection); }} + title="Toggle layout direction" {...props} > {direction} diff --git a/lib/platform-bible-react/src/preview/preview-components/discord-logo.component.tsx b/lib/platform-bible-react/src/preview/preview-components/discord-logo.component.tsx new file mode 100644 index 0000000000..5e0719701e --- /dev/null +++ b/lib/platform-bible-react/src/preview/preview-components/discord-logo.component.tsx @@ -0,0 +1,17 @@ +export default function DiscordLogo() { + return ( + + + + ); +} diff --git a/lib/platform-bible-react/src/preview/preview-components/theme-toggle.component.tsx b/lib/platform-bible-react/src/preview/preview-components/theme-toggle.component.tsx index c1d5a2870c..cc49819e86 100644 --- a/lib/platform-bible-react/src/preview/preview-components/theme-toggle.component.tsx +++ b/lib/platform-bible-react/src/preview/preview-components/theme-toggle.component.tsx @@ -57,6 +57,7 @@ export const ThemeButton = React.forwardRef<