Skip to content

Commit

Permalink
fix: settings screen group filter for lookupSecret (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Sep 5, 2023
1 parent 87372ef commit 3889c95
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/react-components/ory/user-settings-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,22 @@ const body = ({
"webauthn",
"totp",
] as UserSettingsFlowType[]
).map(
(flowType) =>
flow.ui.nodes.some(({ group }) => group === flowType) && (
<div
className={settingsCardContainerClassName}
id={flowType}
key={flowType}
>
<UserSettingsCard flowType={flowType} flow={flow} />
<Divider fullWidth={false} className={dividerClassName} />
</div>
),
)}
).map((flowType) => {
const $card = <UserSettingsCard flowType={flowType} flow={flow} />
if (!$card) {
return null
}
return (
<div
className={settingsCardContainerClassName}
id={flowType}
key={flowType}
>
{$card}
<Divider fullWidth={false} className={dividerClassName} />
</div>
)
})}
</>
)

Expand Down
36 changes: 36 additions & 0 deletions src/stories/Ory/SettingsScreen.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ComponentProps } from "react"
import { Meta, StoryFn } from "@storybook/react"

import { Container } from "../storyhelper"
import {
UserSettingsScreen,
UserSettingsScreenProps,
} from "../../react-components"
import settingsFlow from "./settings-flow.json"
import { SettingsFlow } from "@ory/client"

const Screen = (props: UserSettingsScreenProps) => (
<div style={{ display: "flex", flexDirection: "row" }}>
<UserSettingsScreen.Nav {...props} />
<div style={{ margin: "4rem" }}>
<UserSettingsScreen.Body {...props} />
</div>
</div>
)

export default {
title: "Ory/SettingsScreen",
component: Screen,
} as Meta<typeof Screen>

const Template: StoryFn<ComponentProps<typeof Screen>> = (args) => (
<Container>
<Screen {...args} />
</Container>
)

export const SettingsScreen = Template.bind({})
SettingsScreen.args = {
flow: settingsFlow as SettingsFlow,
logoutUrl: "https://www.ory.sh",
}

0 comments on commit 3889c95

Please sign in to comment.