-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update settings cards and button styles
- Loading branch information
Showing
16 changed files
with
237 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useComponents } from "../../context/component" | ||
import { PropsWithChildren } from "react" | ||
import { HeadlessFormSectionProps } from "../../types" | ||
import { OryForm } from "./form" | ||
|
||
export type HeadlessGroupContainerProps = PropsWithChildren | ||
|
||
export function OryFormSection({ children }: HeadlessFormSectionProps) { | ||
const { FormSection } = useComponents() | ||
|
||
return ( | ||
<OryForm> | ||
<FormSection>{children}</FormSection> | ||
</OryForm> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
export * from "./card" | ||
export * from "./form" | ||
export * from "./generic" | ||
export * from "./settings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./settings-card" |
48 changes: 48 additions & 0 deletions
48
packages/elements-react/src/components/settings/settings-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { UiNodeGroupEnum } from "@ory/client-fetch" | ||
import { useComponents, useOryFlow } from "../../context" | ||
import { useNodesGroups } from "../../util/ui" | ||
import { Node } from "../form/nodes/node" | ||
import { OryFormSection } from "../form/section" | ||
|
||
export function OrySettingsCard() { | ||
const Components = useComponents() | ||
const { flowType, flow } = useOryFlow() | ||
const uniqueGroups = useNodesGroups(flow.ui.nodes) | ||
|
||
return ( | ||
<div className="flex flex-col gap-8 max-w-[848px]"> | ||
{Object.entries(uniqueGroups).map(([group, nodes]) => { | ||
if (group === UiNodeGroupEnum.Default) { | ||
return null | ||
} | ||
|
||
return ( | ||
<OryFormSection key={group} title={group} description={group}> | ||
<Components.FormSectionContent> | ||
{nodes | ||
.filter( | ||
(node) => | ||
"type" in node.attributes && | ||
node.attributes.type !== "submit", | ||
) | ||
.map((node, k) => ( | ||
<Node key={k} node={node} /> | ||
))} | ||
</Components.FormSectionContent> | ||
<Components.FormSectionFooter> | ||
{nodes | ||
.filter( | ||
(node) => | ||
"type" in node.attributes && | ||
node.attributes.type === "submit", | ||
) | ||
.map((node, k) => ( | ||
<Node key={k} node={node} /> | ||
))} | ||
</Components.FormSectionFooter> | ||
</OryFormSection> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/elements-react/src/theme/default/components/form/section.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
HeadlessFormSectionContentProps, | ||
HeadlessFormSectionFooterProps, | ||
HeadlessFormSectionProps, | ||
} from "../../../../types" | ||
|
||
const DefaultFormSection = ({ children }: HeadlessFormSectionProps) => { | ||
return <div className="flex flex-col">{children}</div> | ||
} | ||
|
||
const DefaultFormSectionContent = ({ | ||
children, | ||
}: HeadlessFormSectionContentProps) => { | ||
return ( | ||
<div className="border rounded-t-xl border-b-0 border-dialog-border-default bg-forms-bg-default px-6 py-8 flex flex-col gap-8"> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
const DefaultFormSectionFooter = ({ | ||
children, | ||
}: HeadlessFormSectionFooterProps) => { | ||
return ( | ||
<div className="rounded-b-xl flex justify-end px-6 py-4 bg-dialog-bg-subtle border border-dialog-border-default"> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export { | ||
DefaultFormSection, | ||
DefaultFormSectionContent, | ||
DefaultFormSectionFooter, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.