-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clerk-js): Display a callout when updating or removing a verifie…
…d domain (#1641) * feat(clerk-js): Display a callout when updating or removing a verified domain * chore(clerk-js): Add changeset * test(clerk-js): Update snapshot of OrganizationDomain * chore(clerk-js): CallWithAction default icon styling * fix(clerk-js): Remove complex logic for localizations
- Loading branch information
1 parent
899441f
commit d2ffb25
Showing
9 changed files
with
156 additions
and
36 deletions.
There are no files selected for viewing
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,2 @@ | ||
--- | ||
--- |
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 |
---|---|---|
@@ -1,47 +1,67 @@ | ||
import type { MouseEvent } from 'react'; | ||
import type { ComponentType, MouseEvent, PropsWithChildren } from 'react'; | ||
|
||
import { Col, Flex, Link, Text } from '../customizables'; | ||
import { Col, Flex, Link, Text, Icon } from '../customizables'; | ||
import type { LocalizationKey } from '../localization'; | ||
import type { ThemableCssProp } from '../styledSystem'; | ||
|
||
type CalloutWithActionProps = { | ||
text: LocalizationKey; | ||
text?: LocalizationKey | string; | ||
textSx?: ThemableCssProp; | ||
actionLabel?: LocalizationKey; | ||
onClick?: (e: MouseEvent<HTMLAnchorElement>) => Promise<any>; | ||
icon: ComponentType; | ||
}; | ||
export const CalloutWithAction = (props: CalloutWithActionProps) => { | ||
const { text, actionLabel, onClick: onClickProp } = props; | ||
export const CalloutWithAction = (props: PropsWithChildren<CalloutWithActionProps>) => { | ||
const { icon, text, textSx, actionLabel, onClick: onClickProp } = props; | ||
|
||
const onClick = (e: MouseEvent<HTMLAnchorElement>) => { | ||
if (onClickProp) { | ||
void onClickProp?.(e); | ||
} | ||
}; | ||
|
||
console.log(props.children); | ||
|
||
return ( | ||
<Flex | ||
sx={theme => ({ | ||
background: theme.colors.$blackAlpha50, | ||
padding: theme.space.$4, | ||
padding: `${theme.space.$2x5} ${theme.space.$4}`, | ||
justifyContent: 'space-between', | ||
alignItems: 'flex-start', | ||
borderRadius: theme.radii.$md, | ||
})} | ||
> | ||
<Col gap={4}> | ||
<Text | ||
sx={t => ({ | ||
lineHeight: t.lineHeights.$tall, | ||
})} | ||
localizationKey={text} | ||
<Flex gap={2}> | ||
<Icon | ||
colorScheme='neutral' | ||
icon={icon} | ||
sx={t => ({ marginTop: t.space.$1 })} | ||
/> | ||
<Col gap={4}> | ||
<Text | ||
colorScheme='neutral' | ||
sx={[ | ||
t => ({ | ||
lineHeight: t.lineHeights.$base, | ||
}), | ||
textSx, | ||
]} | ||
localizationKey={text} | ||
> | ||
{props.children} | ||
</Text> | ||
|
||
<Link | ||
colorScheme={'primary'} | ||
variant='regularMedium' | ||
localizationKey={actionLabel} | ||
onClick={onClick} | ||
/> | ||
</Col> | ||
{actionLabel && ( | ||
<Link | ||
colorScheme={'primary'} | ||
variant='regularMedium' | ||
localizationKey={actionLabel} | ||
onClick={onClick} | ||
/> | ||
)} | ||
</Col> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; |
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
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