Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(API Key Modal): heading,label and downloadlink #6298

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const APIKeyDownloader = ({
fileName,
fileType,
linkText,
DownloadLinkLabel,
anamikaanu96 marked this conversation as resolved.
Show resolved Hide resolved
}) => {
const [linkProps, setLinkProps] = useState({});

Expand Down Expand Up @@ -44,6 +45,8 @@ export const APIKeyDownloader = ({
<a
{...linkProps}
className={`${pkg.prefix}--apikey-modal__download-link`}
aria-label={DownloadLinkLabel ?? linkText}
anamikaanu96 marked this conversation as resolved.
Show resolved Hide resolved
role="button"
>
{linkText}
</a>
Expand All @@ -54,6 +57,10 @@ export const APIKeyDownloader = ({

APIKeyDownloader.displayName = componentName;
APIKeyDownloader.propTypes = {
/**
* aria-label for the download link
*/
DownloadLinkLabel: PropTypes.string,
anamikaanu96 marked this conversation as resolved.
Show resolved Hide resolved
/**
* the api key that's displayed to the user when a request to create is fulfilled.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const defaultProps = {
downloadBodyText:
'This is your unique API key and is non-recoverable. If you lose this API key, you will have to reset it.',
downloadLinkText: 'Download as JSON',
downloadLinkLabel: 'Download API Key in Java Script File format',
hasDownloadLink: true,
downloadFileName: 'apikey',
downloadFileType: 'json',
Expand All @@ -76,7 +77,7 @@ const defaultProps = {
generateSuccessTitle: 'API key successfully created',
editSuccessTitle: 'API key successfully saved',
loadingText: 'Generating...',
modalLabel: 'Generate API key',
modalLabel: 'An example of Generate API key',
};

const blockClass = `${pkg.prefix}--apikey-modal`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const defaultProps = {
downloadFileName: 'filename',
downloadFileType: 'json',
downloadLinkText: 'download link text',
downloadLinkLabel: 'Download API Key in Java Script File format',
editButtonText: 'edit button',
editSuccess: false,
editSuccessTitle: 'edited successfully',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export let APIKeyModal: React.FC<APIKeyModalProps> = forwardRef(
downloadFileName,
downloadFileType,
downloadLinkText,
downloadLinkLabel = downloadLinkText,
editButtonText,
editSuccess,
editSuccessTitle,
Expand Down Expand Up @@ -289,6 +290,7 @@ export let APIKeyModal: React.FC<APIKeyModalProps> = forwardRef(
fileName={downloadFileName}
linkText={downloadLinkText}
fileType={downloadFileType}
DownloadLinkLabel={downloadLinkLabel}
anamikaanu96 marked this conversation as resolved.
Show resolved Hide resolved
/>
) : (
<div className={`${blockClass}__messaging-text`}>
Expand Down Expand Up @@ -403,6 +405,10 @@ APIKeyModal.propTypes = {
* designates the file type for the downloadable key
*/
downloadFileType: downloadRequiredProps(PropTypes.oneOf(['txt', 'json'])),
/**
* aria-label for the download link
*/
downloadLinkLabel: downloadRequiredProps(PropTypes.string),
/**
* anchor text for the download link
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ type HasDownloadLinkProps = {
* anchor text for the download link
*/
downloadLinkText: string;
/**
* Aria-label for the download link
*/
downloadLinkLabel?: string;
};

export type APIKeyModalProps = APIKeyModalCommonProps &
Expand Down
Loading