Skip to content

Commit

Permalink
fix: align font sizes to design & use updated variable names (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Dec 30, 2024
1 parent 0ce7e0f commit d5a5895
Show file tree
Hide file tree
Showing 46 changed files with 732 additions and 458 deletions.
17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,26 @@ const config = tseslint.config([
files: ["packages/elements-react/**/*.{js,jsx,ts,tsx}"],
...tailwind.configs["flat/recommended"][0],
...tailwind.configs["flat/recommended"][1],
rules: {
...tailwind.configs["flat/recommended"][1].rules,
"tailwindcss/classnames-order": "off",
"tailwindcss/no-custom-classname": [
"warn",
{
cssFiles: [
"packages/elements-react/**/*.css",
"!**/node_modules",
"!**/.*",
"!**/dist",
"!**/build",
],
},
],
},
settings: {
tailwindcss: {
config: "packages/elements-react/tailwind.config.ts",
callees: ["classnames", "clsx", "ctl", "cn"],
},
},
},
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

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

10 changes: 7 additions & 3 deletions packages/elements-react/api-report/elements-react.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,8 @@
},
{
"kind": "Reference",
"text": "OryFormSectionContentProps",
"canonicalReference": "@ory/elements-react!OryFormSectionContentProps:type"
"text": "OryFormSectionFooterProps",
"canonicalReference": "@ory/elements-react!OryFormSectionFooterProps:type"
},
{
"kind": "Content",
Expand Down Expand Up @@ -2308,6 +2308,10 @@
"text": "PropsWithChildren",
"canonicalReference": "@types/react!React.PropsWithChildren:type"
},
{
"kind": "Content",
"text": "<{\n text?: string;\n}>"
},
{
"kind": "Content",
"text": ";"
Expand All @@ -2318,7 +2322,7 @@
"name": "OryFormSectionFooterProps",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
"endIndex": 3
}
},
{
Expand Down
6 changes: 4 additions & 2 deletions packages/elements-react/api-report/elements-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export type OryFlowComponents = {
AuthMethodListItem: ComponentType<OryCardAuthMethodListItemProps>;
SettingsSection: ComponentType<OryFormSectionProps>;
SettingsSectionContent: ComponentType<OryFormSectionContentProps>;
SettingsSectionFooter: ComponentType<OryFormSectionContentProps>;
SettingsSectionFooter: ComponentType<OryFormSectionFooterProps>;
};
Form: {
Root: ComponentType<OryFormRootProps>;
Expand Down Expand Up @@ -265,7 +265,9 @@ export type OryFormSectionContentProps = PropsWithChildren<{
}>;

// @public (undocumented)
export type OryFormSectionFooterProps = PropsWithChildren;
export type OryFormSectionFooterProps = PropsWithChildren<{
text?: string;
}>;

// @public (undocumented)
export type OryFormSectionProps = PropsWithChildren<{
Expand Down
1 change: 1 addition & 0 deletions packages/elements-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"esbuild-plugin-svgr": "3.0.0",
"eslint-plugin-react": "7.37.1",
"postcss": "8.4.47",
"tailwindcss-animate": "1.0.7",
"tsup": "8.3.0"
},
"keywords": [
Expand Down
3 changes: 2 additions & 1 deletion packages/elements-react/src/components/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
OryCardLogoProps,
OryFormRootProps,
OryFormSectionContentProps,
OryFormSectionFooterProps,
OryNodeAnchorProps,
OryNodeButtonProps,
OryNodeImageProps,
Expand Down Expand Up @@ -148,7 +149,7 @@ export type OryFlowComponents = {
/**
* The SettingsSectionFooter component is rendered around the footer of each section of the settings.
*/
SettingsSectionFooter: ComponentType<OryFormSectionContentProps>
SettingsSectionFooter: ComponentType<OryFormSectionFooterProps>
}
Form: {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export function OrySettingsOidc({ nodes }: HeadlessSettingsOidcProps) {
unlinkButtons={unlinkButtons}
/>
</Card.SettingsSectionContent>
<Card.SettingsSectionFooter>
<span>{intl.formatMessage({ id: "settings.oidc.info" })}</span>
</Card.SettingsSectionFooter>
<Card.SettingsSectionFooter
text={intl.formatMessage({ id: "settings.oidc.info" })}
></Card.SettingsSectionFooter>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export function OrySettingsPasskey({ nodes }: HeadlessSettingsPasskeyProps) {
removeButtons={removeNodes}
/>
</Card.SettingsSectionContent>
<Card.SettingsSectionFooter>
<span>{intl.formatMessage({ id: "settings.passkey.info" })}</span>
</Card.SettingsSectionFooter>
<Card.SettingsSectionFooter
text={intl.formatMessage({ id: "settings.passkey.info" })}
></Card.SettingsSectionFooter>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ export function OrySettingsTotp({ nodes }: HeadlessSettingsTotpProps) {
>
{content}
</Card.SettingsSectionContent>
<Card.SettingsSectionFooter>
<span>
{totpUnlink
<Card.SettingsSectionFooter
text={
totpUnlink
? intl.formatMessage({ id: "settings.totp.info.linked" })
: intl.formatMessage({ id: "settings.totp.info.not-linked" })}
</span>
: intl.formatMessage({ id: "settings.totp.info.not-linked" })
}
>
{totpLinkButton && (
<Node.Button
node={totpLinkButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export function OrySettingsWebauthn({ nodes }: HeadlessSettingsWebauthnProps) {
/>
{registerNode && <Node node={registerNode} />}
</Card.SettingsSectionContent>
<Card.SettingsSectionFooter>
<span>{intl.formatMessage({ id: "settings.webauthn.info" })}</span>
</Card.SettingsSectionFooter>
<Card.SettingsSectionFooter
text={intl.formatMessage({ id: "settings.webauthn.info" })}
></Card.SettingsSectionFooter>
</>
)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,31 @@ export function DefaultAuthMethodListItem({
const Icon = iconsMap[group] || null

return (
<div className="w-full rounded px-2 py-1 hover:bg-forms-bg-hover">
<div className="w-full rounded px-2 py-1 hover:bg-interface-background-default-primary-hover">
<button
className="flex cursor-pointer gap-3 py-2 text-left"
className="flex cursor-pointer gap-3 py-2 text-left items-start"
onClick={onClick}
type={isGroupImmediateSubmit(group) ? "submit" : "button"}
id={`auth-method-list-item-${group}`}
data-testid="auth-method-list-item"
aria-label={`Authenticate with ${group}`}
>
<div className={"mt-[2px] size-4 flex-none"}>
{Icon && <Icon size={20} className="text-forms-fg-default" />}
</div>
<div className={"flex-1 text-sm leading-normal"}>
<div className="text-sm text-forms-fg-default">
<span className="mt-1">
{Icon && (
<Icon
size={16}
className="text-interface-foreground-brand-primary"
/>
)}
</span>
<span className="flex-1 leading-normal inline-flex flex-col">
<span className="text-interface-foreground-default-primary">
{intl.formatMessage({ id: `two-step.${group}.title` })}
</div>
<div className="text-sm text-forms-fg-mute">
</span>
<span className="text-interface-foreground-default-secondary">
{intl.formatMessage({ id: `two-step.${group}.description` })}
</div>
</div>
</span>
</span>
</button>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import OryLogoVertical from "../../assets/ory-badge-vertical.svg"

export function Badge() {
return (
<div className="absolute bg-branding-bg-default p-2 font-bold max-md:bottom-0 max-md:left-8 max-md:translate-y-full max-md:rounded-b-md md:right-0 md:top-8 md:translate-x-full md:rounded-r-md">
<OryLogoHorizontal width={22} height={8} className="md:hidden" />
<OryLogoVertical width={8} height={22} className="max-md:hidden" />
<div className="absolute bg-ory-background-default p-2 font-bold max-sm:bottom-0 max-sm:left-8 max-sm:translate-y-full max-sm:rounded-b-md sm:right-0 sm:top-8 sm:translate-x-full sm:rounded-r-lg border-ory-border-default border max-sm:py-[7px] sm:pl-[7px]">
<OryLogoHorizontal width={22} height={8} className="sm:hidden" />
<OryLogoVertical width={8} height={22} className="max-sm:hidden" />
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ export function DefaultCurrentIdentifierButton() {

return (
<a
className="inline-flex max-w-full cursor-pointer items-center gap-1 self-start rounded-full border border-button-identifier-border-default bg-button-identifier-bg-default px-3 py-[5px] transition-colors hover:border-button-identifier-border-hover hover:bg-button-identifier-bg-hover"
className={
"group inline-flex max-w-full cursor-pointer items-center gap-1 self-start rounded-full border px-[11px] py-[5px] transition-colors " +
"border-button-identifier-border-border-default bg-button-identifier-background-default hover:border-button-identifier-border-border-hover hover:bg-button-identifier-background-hover"
}
{...attributes}
href={initFlowUrl}
title={`Adjust ${nodeBackButton?.attributes.value}`}
>
<IconArrowLeft
size={16}
className="shrink-0 text-button-identifier-fg-subtle"
/>
<span className="overflow-hidden text-ellipsis text-nowrap text-sm font-medium text-button-identifier-fg-default">
{nodeBackButton?.attributes.value}
<span className="inline-flex min-h-5 items-center gap-2 overflow-hidden text-ellipsis">
<IconArrowLeft
size={16}
stroke="1"
className="shrink-0 text-button-identifier-foreground-default group-hover:text-button-identifier-foreground-hover"
/>
<span className="overflow-hidden text-ellipsis text-nowrap text-sm font-medium text-button-identifier-foreground-default group-hover:text-button-identifier-foreground-hover">
{nodeBackButton?.attributes.value}
</span>
</span>
</a>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ function LoginCardFooter() {
}

return (
<span className="text-sm font-normal leading-normal antialiased">
<span className="font-normal leading-normal antialiased text-interface-foreground-default-primary">
{intl.formatMessage({
id: "login.registration-label",
defaultMessage: "No account?",
})}{" "}
<a
className="text-links-link-default transition-colors hover:text-links-link-hover hover:underline"
className="text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline"
href={registrationLink}
>
{intl.formatMessage({
Expand Down Expand Up @@ -102,12 +102,12 @@ function RegistrationCardFooter() {
}

return (
<span className="text-sm font-normal leading-normal antialiased">
<span className="font-normal leading-normal antialiased">
{formState.current === "method_active" ? (
<>
{screenSelectionNode && (
<button
className="font-medium text-links-link-default"
className="font-medium text-button-link-brand-brand hover:text-button-link-brand-brand-hover"
type="submit"
onClick={handleScreenSelection}
>
Expand All @@ -125,7 +125,7 @@ function RegistrationCardFooter() {
defaultMessage: "Already have an account?",
})}{" "}
<a
className="text-links-link-default transition-colors hover:text-links-link-hover hover:underline"
className="text-button-link-brand-brand transition-colors hover:text-button-link-brand-brand-hover underline"
href={loginLink}
>
{intl.formatMessage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ function InnerCardHeader({ title, text }: { title: string; text?: string }) {
<header className="flex flex-col gap-8 antialiased">
<Card.Logo />
<div className="flex flex-col gap-2">
<h2 className="text-lg font-semibold leading-normal text-dialog-fg-default">
<h2 className="text-lg font-semibold leading-normal text-interface-foreground-default-primary">
{title}
</h2>
<p className="text-sm leading-normal text-dialog-fg-subtle">{text}</p>
<p className="leading-normal text-interface-foreground-default-secondary">
{text}
</p>
<DefaultCurrentIdentifierButton />
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { DefaultCardLayout } from "./layout"

export function DefaultCard({ children }: OryCardProps) {
return (
<div className="flex flex-1 flex-col items-center justify-center font-sans">
<div className="relative grid max-w-sm grid-cols-1 gap-8 rounded-border-radius-cards border border-dialog-border-default bg-dialog-bg-default px-8 py-12 md:w-[480px] md:max-w-[480px] md:px-12 md:py-14">
<div className="flex flex-1 sm:items-center justify-center font-sans items-start w-full sm:w-[480px] sm:max-w-[480px]">
<div className="relative grid grid-cols-1 gap-8 sm:rounded-cards sm:border border-form-border-default bg-form-background-default px-8 py-12 sm:px-12 sm:py-14 border-b w-full">
{children}
<Badge />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PropsWithChildren } from "react"

export function DefaultCardLayout({ children }: PropsWithChildren) {
return (
<main className="pt-4 p-4 pb-8 flex items-center justify-center flex-col gap-8 min-h-screen">
<main className="p-4 pb-8 flex items-center justify-center flex-col gap-8 min-h-screen">
{children}
</main>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function DefaultCardLogo() {
}

return (
<h1 className="text-xl font-semibold leading-normal text-dialog-fg-default">
<h1 className="text-xl font-semibold leading-normal text-interface-foreground-default-primary">
{flow.config.name}
</h1>
)
Expand Down
Loading

0 comments on commit d5a5895

Please sign in to comment.