-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into PE-6993-ant-cu-url
- Loading branch information
Showing
53 changed files
with
4,674 additions
and
581 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 |
---|---|---|
|
@@ -11,4 +11,6 @@ docs | |
dist-id.txt | ||
dist-manifest.csv | ||
dist-manifest.json | ||
test-results | ||
test-results | ||
storybook-static | ||
*storybook.log |
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,22 @@ | ||
import type { StorybookConfig } from '@storybook/react-vite'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
|
||
addons: [ | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
], | ||
|
||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
|
||
typescript: { | ||
reactDocgen: 'react-docgen-typescript', | ||
}, | ||
}; | ||
export default config; |
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,14 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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
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,57 @@ | ||
import { useGlobalState } from '@src/state'; | ||
import { CSSProperties, useEffect, useRef, useState } from 'react'; | ||
import { ReactNode } from 'react-markdown'; | ||
|
||
import { HamburgerOutlineIcon } from '../icons'; | ||
|
||
export function AntLogoIcon({ | ||
id, | ||
className, | ||
style, | ||
icon = ( | ||
<HamburgerOutlineIcon | ||
width={'20px'} | ||
height={'20px'} | ||
fill="var(--text-white)" | ||
/> | ||
), | ||
}: { | ||
id?: string; | ||
className?: string; | ||
icon?: ReactNode; | ||
style?: CSSProperties; | ||
}) { | ||
const [{ gateway }] = useGlobalState(); | ||
const [validImage, setValidImage] = useState(true); | ||
const logoRef = useRef<HTMLImageElement>(null); | ||
|
||
useEffect(() => { | ||
if (!logoRef.current || !id) return; | ||
|
||
const img = logoRef.current; | ||
setValidImage(true); | ||
|
||
const handleError = () => setValidImage(false); | ||
|
||
img.addEventListener('error', handleError); | ||
|
||
return () => { | ||
img.removeEventListener('error', handleError); | ||
}; | ||
}, [logoRef, id]); | ||
|
||
if (!id) return <>{icon}</>; | ||
|
||
return ( | ||
<> | ||
<img | ||
ref={logoRef} | ||
className={className ?? 'w-[30px] rounded-full'} | ||
src={`https://${gateway}/${id}`} | ||
alt="ant-logo" | ||
style={{ display: validImage ? 'block' : 'none', ...(style ?? {}) }} | ||
/> | ||
{!validImage && icon} | ||
</> | ||
); | ||
} |
Oops, something went wrong.