Skip to content

Commit

Permalink
fix!: improve component naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Oct 10, 2024
1 parent 64f1def commit 37f30d4
Show file tree
Hide file tree
Showing 75 changed files with 1,957 additions and 2,957 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CONTRIBUTING.md
docs
.next
.cache
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,4 +1,3 @@
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 @@ -28,11 +27,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,18 +1,18 @@
import { LoginFlowFromJSON } from "@ory/client-fetch"
import {
HeadlessSocialButtonProps,
OryCard,
OryCardContent,
OryForm,
OryFormGroups,
OryFormSocialButtons,
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 @@ -22,12 +22,14 @@ 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}
>
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
34 changes: 0 additions & 34 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

0 comments on commit 37f30d4

Please sign in to comment.