Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: improve component naming #218

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ docs

# Generated files
CHANGELOG.md
**/api-report/*
**/api-report/*
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions packages/elements-react-stories/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { IntlProvider } from "@ory/elements-react"
import type { Decorator, Preview } from "@storybook/react"
import { chromaticModes } from "./modes"
import "@ory/elements-react/theme/styles.css"
Expand Down Expand Up @@ -31,11 +30,8 @@ const preview: Preview = {
const withI18next: Decorator = (Story, context) => {
const { locale } = context.globals

return (
<IntlProvider locale={locale} defaultLocale="en">
<Story />
</IntlProvider>
)
// TODO: this needs a refactor, because it doesn't pass the locale to the Ory Provider at the moment.
return <Story args={{ locale }} />
}

// export decorators for storybook to wrap your stories in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { LoginFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
import { Login } from "../../../pages/login"
import { Login } from "@ory/elements-react/theme"
import { config } from "../../../utils"

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Login } from "../../../pages/login"
import { Login } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { LoginFlowFromJSON } from "@ory/client-fetch"
import {
HeadlessSocialButtonProps,
OryCard,
OryCardContent,
OryForm,
OryFormGroups,
OryFormSocialButtons,
OryFormOidcButtons,
OryNodeOidcButtonProps,
} from "@ory/elements-react"
import { FlowContextProps, Login } from "../../../pages/login"
import { Login, LoginFlowContextProps } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON } from "@ory/client-fetch"

import type { Meta, StoryObj } from "@storybook/react"

const CustomSocialButton = ({ node }: HeadlessSocialButtonProps) => (
const CustomSocialButton = ({ node }: OryNodeOidcButtonProps) => (
<div
className={
"antialiased rounded-border-radius-buttons border border-transparent gap-3 leading-none bg-button-primary-bg-default hover:bg-button-primary-bg-hover transition-colors text-button-primary-fg-default hover:text-button-primary-fg-hover px-4 py-4.5 text-sm font-medium"
Expand All @@ -25,19 +25,21 @@ const CustomSocialButton = ({ node }: HeadlessSocialButtonProps) => (
</div>
)

const CustomComponents = ({ flow, config }: FlowContextProps) => {
const CustomComponents = ({ flow, config }: LoginFlowContextProps) => {
return (
<Login
flow={flow}
components={{
SocialButton: CustomSocialButton,
Node: {
OidcButton: CustomSocialButton,
},
}}
config={config}
>
<OryCard>
<OryCardContent>
<OryForm>
<OryFormSocialButtons />
<OryFormOidcButtons />
<div>
Even though the code method is available, we do not show it here
with our customization:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Login } from "../../../pages/login"
import { Login } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Login } from "../../../pages/login"
import { Login } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Registration } from "../../../pages/registration"
import { Registration } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON, RegistrationFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Registration } from "../../../pages/registration"
import { Registration } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON, RegistrationFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Registration } from "../../../pages/registration"
import { Registration } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { RegistrationFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Registration } from "../../../pages/registration"
import { Registration } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON, RegistrationFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { Registration } from "../../../pages/registration"
import { Registration } from "@ory/elements-react/theme"
import { config } from "../../../utils"
import { LoginFlowFromJSON, RegistrationFlowFromJSON } from "@ory/client-fetch"
import type { Meta, StoryObj } from "@storybook/react"
Expand Down
37 changes: 0 additions & 37 deletions packages/elements-react-stories/src/elements-react/pages/login.tsx

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions packages/elements-react/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
playwright/.cache/
playwright-report/*
.last-run.json

api-report/temp
api-report/temp
Loading
Loading