Skip to content

Commit

Permalink
feat(clerk-js): Update Development notice to match designs
Browse files Browse the repository at this point in the history
  • Loading branch information
octoper committed Jul 12, 2024
1 parent f3a3fe6 commit e4f6058
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useClerk } from '@clerk/shared/react';

import { useCreateOrganizationContext } from '../../contexts';
import { useCreateOrganizationContext, useEnvironment } from '../../contexts';
import { localizationKeys } from '../../customizables';
import { Card, useCardState, withCardStateProvider } from '../../elements';
import { CreateOrganizationForm } from './CreateOrganizationForm';
Expand All @@ -10,10 +10,13 @@ export const CreateOrganizationPage = withCardStateProvider(() => {

const { mode, navigateAfterCreateOrganization, skipInvitationScreen } = useCreateOrganizationContext();
const card = useCardState();
const { isDevelopmentOrStaging } = useEnvironment();

return (
<Card.Root sx={t => ({ width: t.sizes.$108 })}>
<Card.Content sx={t => ({ padding: `${t.space.$4} ${t.space.$5} ${t.space.$6}` })}>
<Card.Content
sx={t => ({ padding: `${t.space.$4} ${t.space.$5} ${isDevelopmentOrStaging() ? t.space.$12 : t.space.$6}` })}
>
<Card.Alert>{card.error}</Card.Alert>
<CreateOrganizationForm
skipInvitationScreen={skipInvitationScreen}
Expand Down
14 changes: 9 additions & 5 deletions packages/clerk-js/src/ui/elements/Card/CardClerkAndPagesTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ import React from 'react';
import { useEnvironment } from '../../contexts';
import { Col, Flex, Icon, Link, Text } from '../../customizables';
import { LogoMark } from '../../icons';
import type { PropsOfComponent } from '../../styledSystem';
import type { PropsOfComponent, ThemableCssProp } from '../../styledSystem';
import { DevModeNotice } from '../DevModeNotice';
import { Card } from '.';

export const CardClerkAndPagesTag = React.memo(
React.forwardRef<
HTMLDivElement,
PropsOfComponent<typeof Flex> & { withFooterPages?: boolean; withDevModeNotice?: boolean }
PropsOfComponent<typeof Flex> & {
withFooterPages?: boolean;
withDevModeNotice?: boolean;
devModeNoticeSx?: ThemableCssProp;
}
>((props, ref) => {
const { sx, withFooterPages = false, withDevModeNotice = false, ...rest } = props;
const { sx, withFooterPages = false, withDevModeNotice = false, devModeNoticeSx, ...rest } = props;
const { displayConfig } = useEnvironment();

if (!(displayConfig.branded || withFooterPages)) {
if (!(displayConfig.branded || withFooterPages) && !withDevModeNotice) {
return null;
}

Expand Down Expand Up @@ -62,7 +66,7 @@ export const CardClerkAndPagesTag = React.memo(
{withFooterPages && <Card.FooterLinks />}
</Flex>

{withDevModeNotice && <DevModeNotice />}
{withDevModeNotice && <DevModeNotice sx={devModeNoticeSx} />}
</Col>
);
}),
Expand Down
10 changes: 6 additions & 4 deletions packages/clerk-js/src/ui/elements/Card/CardContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useLocalizations,
} from '../../customizables';
import { Close } from '../../icons';
import { type PropsOfComponent } from '../../styledSystem';
import type { PropsOfComponent } from '../../styledSystem';
import { useCardState, useFlowMetadata } from '../contexts';
import { DevModeNotice, DevModeOverlay } from '../DevModeNotice';
import { IconButton } from '../IconButton';
Expand All @@ -25,6 +25,7 @@ export const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>((p
const { maintenanceMode } = useEnvironment();
const card = useCardState();
const { t } = useLocalizations();
const { isDevelopmentOrStaging } = useEnvironment();

return (
<Flex
Expand All @@ -44,7 +45,7 @@ export const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>((p
boxShadow: t.shadows.$cardContentShadow,
borderRadius: t.radii.$lg,
position: 'relative',
padding: `${t.space.$8} ${t.space.$10}`,
padding: `${t.space.$8} ${t.space.$10} ${isDevelopmentOrStaging() ? t.space.$12 : t.space.$8} ${t.space.$10}`,
justifyContent: 'center',
alignContent: 'center',
}),
Expand Down Expand Up @@ -84,13 +85,14 @@ export const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>((p
{children}

<DevModeNotice
sx={{
sx={t => ({
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
textAlign: 'center',
}}
padding: t.space.$3,
})}
/>
</Flex>
);
Expand Down
1 change: 0 additions & 1 deletion packages/clerk-js/src/ui/elements/DevModeNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const DevModeNotice = (props: DevModeNoticeProps) => {
t => ({
color: t.colors.$warning500,
fontWeight: t.fontWeights.$semibold,
whiteSpace: 'nowrap',
padding: t.space.$1x5,
}),
sx,
Expand Down
13 changes: 11 additions & 2 deletions packages/clerk-js/src/ui/elements/PopoverCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Col, Flex, Flow, useAppearance } from '../customizables';
import type { PropsOfComponent } from '../styledSystem';
import { animations, common } from '../styledSystem';
import { colors } from '../utils';
import { Card } from '.';
import { Card, DevModeOverlay } from '.';

const PopoverCardRoot = React.forwardRef<HTMLDivElement, PropsOfComponent<typeof Card.Content>>((props, ref) => {
return (
Expand Down Expand Up @@ -87,9 +87,18 @@ const PopoverCardFooter = (props: PropsOfComponent<typeof Flex>) => {
]}
{...rest}
>
<DevModeOverlay />
{children}

{shouldShowTagOrLinks && <Card.ClerkAndPagesTag withFooterPages />}
{shouldShowTagOrLinks && (
<Card.ClerkAndPagesTag
withFooterPages
withDevModeNotice
devModeNoticeSx={t => ({
padding: t.space.$none,
})}
/>
)}
</Col>
);
};
Expand Down

0 comments on commit e4f6058

Please sign in to comment.