diff --git a/apps/ui-playground/app/(home)/page.tsx b/apps/ui-playground/app/(home)/page.tsx index b7f52d73a34317..d9297f4950d97b 100644 --- a/apps/ui-playground/app/(home)/page.tsx +++ b/apps/ui-playground/app/(home)/page.tsx @@ -1,11 +1,11 @@ +import { useTranslations } from "next-intl"; export default function Page() { +const t = useTranslations("homepage-hero"); + return (
-

- Open UI for absolutely -
everyone -

+

{t('heading.open-ui-for-absolutely')}
{t('heading.everyone')}

); diff --git a/apps/ui-playground/components/ui/IconGrid.tsx b/apps/ui-playground/components/ui/IconGrid.tsx index 6bcdb153d06a87..9d38702c40bfb5 100644 --- a/apps/ui-playground/components/ui/IconGrid.tsx +++ b/apps/ui-playground/components/ui/IconGrid.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import React, { useState, useMemo } from "react"; import { Toaster } from "react-hot-toast"; @@ -160,20 +162,22 @@ interface CopyMenuProps { } const CopyMenu: React.FC = ({ name, onCopy }) => { +const t = useTranslations("icon-grid-demo"); + return (
+ className="hover:bg-subtle w-full rounded px-3 py-1 text-left text-sm">{t('actions.copy-component')}
); }; export const IconGrid: React.FC = ({ className }) => { +const t = useTranslations("icon-grid-demo"); + const [searchQuery, setSearchQuery] = useState(""); const handleCopy = async (value: string) => { @@ -344,7 +348,7 @@ export const IconGrid: React.FC = ({ className }) => {
setSearchQuery(e.target.value)} className="border-subtle bg-default text-emphasis focus:ring-emphasis placeholder:text-subtle w-full rounded-md border px-4 py-2 focus:outline-none focus:ring-2" diff --git a/apps/ui-playground/content/design/components/alert.actions.tsx b/apps/ui-playground/content/design/components/alert.actions.tsx index 28e3877c8a8155..70c5125b31d388 100644 --- a/apps/ui-playground/content/design/components/alert.actions.tsx +++ b/apps/ui-playground/content/design/components/alert.actions.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; @@ -6,19 +8,22 @@ import { Alert } from "@calcom/ui/components/alert"; const severities = ["neutral", "info", "warning", "error"] as const; -export const ActionsExample: React.FC = () => ( +export const ActionsExample: React.FC = () => { +const t = useTranslations("alert-actions-demo"); + +return (
{severities.map((severity) => ( - - + +
} /> @@ -26,3 +31,4 @@ export const ActionsExample: React.FC = () => (
); +}; diff --git a/apps/ui-playground/content/design/components/avatar.image.tsx b/apps/ui-playground/content/design/components/avatar.image.tsx index 2c20ec8e52b925..84da38306b13ba 100644 --- a/apps/ui-playground/content/design/components/avatar.image.tsx +++ b/apps/ui-playground/content/design/components/avatar.image.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; @@ -6,17 +8,21 @@ import { Avatar } from "@calcom/ui/components/avatar"; const sampleImage = "https://cal.com/stakeholder/peer.jpg"; -export const ImageExample: React.FC = () => ( +export const ImageExample: React.FC = () => { +const t = useTranslations("avatar-image-demo"); + +return (
- - With Image + + {t('labels.with-image')}
- - Without Image + + {t('labels.without-image')}
-); +) +}; diff --git a/apps/ui-playground/content/design/components/avatar.tooltip.tsx b/apps/ui-playground/content/design/components/avatar.tooltip.tsx index 341d5a06b4b0dd..708bc94ba92b34 100644 --- a/apps/ui-playground/content/design/components/avatar.tooltip.tsx +++ b/apps/ui-playground/content/design/components/avatar.tooltip.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; @@ -6,13 +8,17 @@ import { Avatar } from "@calcom/ui/components/avatar"; const sampleImage = "https://cal.com/stakeholder/peer.jpg"; -export const TooltipExample: React.FC = () => ( +export const TooltipExample: React.FC = () => { +const t = useTranslations("avatar-tooltip-demo"); + +return (
- - Hover to see tooltip + + {t('instructions.hover-tooltip')}
-); +) +}; diff --git a/apps/ui-playground/content/design/components/button.disabled.tsx b/apps/ui-playground/content/design/components/button.disabled.tsx index 9ab2eac138158a..fe22bec49d1d73 100644 --- a/apps/ui-playground/content/design/components/button.disabled.tsx +++ b/apps/ui-playground/content/design/components/button.disabled.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { Row } from "@/app/components/row"; @@ -7,36 +9,48 @@ import { Button } from "@calcom/ui/components/button"; const colors = ["primary", "secondary", "minimal", "destructive"] as const; -export const DisabledExample: React.FC = () => ( +export const DisabledExample: React.FC = () => { +const t = useTranslations("button-disabled-demo"); + +return (
-

Disabled State

+

{t('headings.disabled-state')}

- {colors.map((color) => ( + {colors.map((color) => { +const t = useTranslations("button-disabled-demo"); + +return (
- Disabled + {t('labels.disabled')}
- ))} + ) +})}
-

Disabled with Icons

+

{t('headings.disabled-with-icons')}

- {colors.map((color) => ( + {colors.map((color) => { +const t = useTranslations("button-disabled-demo"); + +return (
- With Icon + {t('labels.with-icon')}
- ))} + ) +})}
-); +) +}; diff --git a/apps/ui-playground/content/design/components/button.variant.tsx b/apps/ui-playground/content/design/components/button.variant.tsx index 0a8d72ebfe2544..24bd551b7f148a 100644 --- a/apps/ui-playground/content/design/components/button.variant.tsx +++ b/apps/ui-playground/content/design/components/button.variant.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { Row } from "@/app/components/row"; @@ -9,12 +11,15 @@ const variants = ["button", "icon"] as const; const colors = ["primary", "secondary", "minimal", "destructive"] as const; const sizes = ["xs", "sm", "base", "lg"] as const; -export const VariantExample: React.FC = () => ( +export const VariantExample: React.FC = () => { +const t = useTranslations("button-variant-demo"); + +return (
{variants.map((variant) => (
-

{variant === "button" ? "Default" : variant}

+

{variant === "button" ? t('variant-labels.default') : variant}

{colors.map((color) => (
@@ -41,3 +46,4 @@ export const VariantExample: React.FC = () => (
); +}; diff --git a/apps/ui-playground/content/design/components/checkbox.labelPosition.tsx b/apps/ui-playground/content/design/components/checkbox.labelPosition.tsx index 66561cfce28e7d..dc4a7689c7cd8b 100644 --- a/apps/ui-playground/content/design/components/checkbox.labelPosition.tsx +++ b/apps/ui-playground/content/design/components/checkbox.labelPosition.tsx @@ -1,24 +1,30 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { CheckboxField } from "@calcom/ui/components/form"; -export const LabelPositionExample: React.FC = () => ( +export const LabelPositionExample: React.FC = () => { +const t = useTranslations("checkbox-label-position-demo"); + +return (
-); +) +}; diff --git a/apps/ui-playground/content/design/components/dialog.largeContent.tsx b/apps/ui-playground/content/design/components/dialog.largeContent.tsx index 0d77357d8b6f25..b158ceeb79c2fd 100644 --- a/apps/ui-playground/content/design/components/dialog.largeContent.tsx +++ b/apps/ui-playground/content/design/components/dialog.largeContent.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { useState } from "react"; @@ -7,48 +9,37 @@ import { Button } from "@calcom/ui/components/button"; import { Dialog, DialogClose, DialogContent, DialogFooter } from "@calcom/ui/components/dialog"; export const LargeContentExample: React.FC = () => { +const t = useTranslations("dialog-large-content-demo"); + const [open, setOpen] = useState(false); return (
- +
{Array.from({ length: 5 }).map((_, i) => (
-

Section {i + 1}

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus - hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend - nibh porttitor. Ut in nulla enim. Phasellus molestie magna non est bibendum non venenatis - nisl tempor. -

-

- Suspendisse in orci enim. Integer vel sapien at risus ultrices ornare nec sit amet nibh. - Duis blandit lectus ac odio rhoncus non congue diam bibendum. Aliquam erat volutpat. -

+

{t('content.section-heading', { "i": i + 1 })}

+

{t('content.lorem-paragraph-one')}

+

{t('content.lorem-paragraph-two')}

{i === 2 && (
-

Important Notice

-

- This is a highlighted section within the content to demonstrate how different UI - elements appear within a scrollable dialog. -

+

{t('notices.important-heading')}

+

{t('notices.important-description')}

)}
))}
- Decline - + {t('buttons.decline')} +
diff --git a/apps/ui-playground/content/design/components/emptyScreen.basic.tsx b/apps/ui-playground/content/design/components/emptyScreen.basic.tsx index bf6e465ad1f747..49c0ed9894a0a9 100644 --- a/apps/ui-playground/content/design/components/emptyScreen.basic.tsx +++ b/apps/ui-playground/content/design/components/emptyScreen.basic.tsx @@ -1,17 +1,23 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; -export const BasicExample: React.FC = () => ( +export const BasicExample: React.FC = () => { +const t = useTranslations("empty-screen-basic"); + +return ( alert("Create Meeting clicked")} /> -); +) +}; diff --git a/apps/ui-playground/content/design/components/emptyScreen.rawButton.tsx b/apps/ui-playground/content/design/components/emptyScreen.rawButton.tsx index 28e3ee740bb2c7..81d313a62533d3 100644 --- a/apps/ui-playground/content/design/components/emptyScreen.rawButton.tsx +++ b/apps/ui-playground/content/design/components/emptyScreen.rawButton.tsx @@ -1,26 +1,28 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { Button } from "@calcom/ui/components/button"; import { EmptyScreen } from "@calcom/ui/components/empty-screen"; -export const RawButtonExample: React.FC = () => ( +export const RawButtonExample: React.FC = () => { +const t = useTranslations("empty-screen-demo"); + +return ( - - + +
} />
-); +) +}; diff --git a/apps/ui-playground/content/design/components/input.states.tsx b/apps/ui-playground/content/design/components/input.states.tsx index f63285e7741027..e241ac505dcc3c 100644 --- a/apps/ui-playground/content/design/components/input.states.tsx +++ b/apps/ui-playground/content/design/components/input.states.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; @@ -15,11 +17,14 @@ export const StatesExample: React.FC = () => (

{state}

- {sizes.map((size) => ( + {sizes.map((size) => { +const t = useTranslations("input-states-demo"); + +return (
( /> {size}
- ))} + ) +})}
))} diff --git a/apps/ui-playground/content/design/components/multiInputField.customization.tsx b/apps/ui-playground/content/design/components/multiInputField.customization.tsx index efa4bf1e448678..b9febfef81bd62 100644 --- a/apps/ui-playground/content/design/components/multiInputField.customization.tsx +++ b/apps/ui-playground/content/design/components/multiInputField.customization.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { useForm, FormProvider } from "react-hook-form"; @@ -13,6 +15,8 @@ type FormValues = { }; export const CustomizationExample: React.FC = () => { +const t = useTranslations("multi-input-field-demo"); + const methods = useForm(); return ( @@ -21,13 +25,13 @@ export const CustomizationExample: React.FC = () => {
-

Key-Value Pairs

-

Allows inputting keys and values

+

{t('sections.key-value-pairs.title')}

+

{t('sections.key-value-pairs.description')}

fieldArrayName="keyValuePairs" keyValueMode - keyLabel="Environment Variable" - valueLabel="Value" + keyLabel={t('labels.environment-variable')} + valueLabel={t('labels.value')} optionPlaceholders={["NODE_ENV", "PORT", "DATABASE_URL"]} valuePlaceholders={["production", "3000", "postgres://..."]} defaultNumberOfOptions={3} @@ -36,31 +40,31 @@ export const CustomizationExample: React.FC = () => {
-

Custom Placeholders

+

{t('sections.custom-placeholders.title')}

fieldArrayName="customPlaceholders" - optionPlaceholders={["Enter your name", "Enter your email", "Enter your phone"]} + optionPlaceholders={[t('sections.custom-placeholders.placeholders.enter-name'), t('sections.custom-placeholders.placeholders.enter-email'), t('sections.custom-placeholders.placeholders.enter-phone')]} defaultNumberOfOptions={3} />
-

Without Move Buttons

+

{t('sections.without-move-buttons.title')}

fieldArrayName="noMoveButtons" - optionPlaceholders={["Static option 1", "Static option 2"]} + optionPlaceholders={[t('sections.without-move-buttons.placeholders.static-option-1'), t('sections.without-move-buttons.placeholders.static-option-2')]} defaultNumberOfOptions={2} showMoveButtons={false} />
-

Custom Add Button Label

+

{t('sections.custom-add-button.title')}

fieldArrayName="customLabel" - optionPlaceholders={["Social media link"]} + optionPlaceholders={[t('sections.custom-add-button.placeholders.social-media-link')]} defaultNumberOfOptions={1} - addOptionLabel="Add another social media link" + addOptionLabel={t('buttons.add-social-media-link')} />
diff --git a/apps/ui-playground/content/design/components/navigation.sidebar.tsx b/apps/ui-playground/content/design/components/navigation.sidebar.tsx index c5cdcc1aab24ee..67881cd71cae79 100644 --- a/apps/ui-playground/content/design/components/navigation.sidebar.tsx +++ b/apps/ui-playground/content/design/components/navigation.sidebar.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { useState } from "react"; @@ -6,6 +8,8 @@ import { useState } from "react"; import { NavigationItem } from "@calcom/ui"; export const SidebarExample: React.FC = () => { +const t = useTranslations("navigation-sidebar-demo"); + const [isDeelExpanded, setIsDeelExpanded] = useState(true); return ( @@ -54,7 +58,7 @@ export const SidebarExample: React.FC = () => { icon: "zap", }} /> -
Manage
+
{t('sections.manage')}
{ +const t = useTranslations("section-subsection-demo"); + const [isMainOpen, setIsMainOpen] = useState(true); const [isFirstSubsectionOpen, setIsFirstSubsectionOpen] = useState(true); const [isSecondSubsectionOpen, setIsSecondSubsectionOpen] = useState(true); @@ -37,7 +41,7 @@ export const SubSectionExample = () => { {isFirstSubsectionOpen && ( -

This is the content of the first subsection.

+

{t('content.first-subsection-description')}

)} @@ -52,10 +56,10 @@ export const SubSectionExample = () => { {isSecondSubsectionOpen && (
-
Field Name
-
Field Type
-
Value
-
When to Write
+
{t('table-headers.field-name')}
+
{t('table-headers.field-type')}
+
{t('table-headers.value')}
+
{t('table-headers.when-to-write')}
diff --git a/apps/ui-playground/content/design/components/select.disabled.tsx b/apps/ui-playground/content/design/components/select.disabled.tsx index 34da21f6a8dae9..ecf403373ed14a 100644 --- a/apps/ui-playground/content/design/components/select.disabled.tsx +++ b/apps/ui-playground/content/design/components/select.disabled.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; @@ -12,16 +14,20 @@ const options = [ { value: "coffee", label: "Coffee" }, ]; -export const DisabledExample: React.FC = () => ( +export const DisabledExample: React.FC = () => { +const t = useTranslations("select-disabled-examples"); + +return (
-
-); +) +}; diff --git a/apps/ui-playground/content/design/components/select.multi.tsx b/apps/ui-playground/content/design/components/select.multi.tsx index 497d5e62dc0e40..e32aa4b15e12fe 100644 --- a/apps/ui-playground/content/design/components/select.multi.tsx +++ b/apps/ui-playground/content/design/components/select.multi.tsx @@ -1,4 +1,6 @@ "use client"; +import { useTranslations } from "next-intl"; + import { RenderComponentWithSnippet } from "@/app/components/render"; import { useState } from "react"; @@ -14,6 +16,8 @@ const options = [ ]; export const MultiExample: React.FC = () => { +const t = useTranslations("select-multi-examples"); + const [multiValue, setMultiValue] = useState<{ value: string; label: string }[]>([]); return ( @@ -25,7 +29,7 @@ export const MultiExample: React.FC = () => { onChange={(newValue) => setMultiValue(newValue as { value: string; label: string }[])} isMulti isClearable - placeholder="Choose multiple flavors..." + placeholder={t('placeholders.choose-multiple-flavors')} />