Browse Source

type: export QRPropsSvg type (#42605)

pull/42648/head
lijianan 2 years ago
committed by GitHub
parent
commit
2777f26909
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      components/index.ts
  2. 12
      components/qrcode/index.tsx
  3. 2
      components/qrcode/interface.ts
  4. 4
      components/qrcode/style/index.ts

2
components/index.ts

@ -94,7 +94,7 @@ export type { PopoverProps } from './popover';
export { default as Progress } from './progress';
export type { ProgressProps } from './progress';
export { default as QRCode } from './qrcode';
export type { QRCodeProps, QRPropsCanvas } from './qrcode/interface';
export type { QRCodeProps, QRPropsCanvas, QRPropsSvg } from './qrcode/interface';
export { default as Radio } from './radio';
export type { RadioChangeEvent, RadioGroupProps, RadioProps } from './radio';
export { default as Rate } from './rate';

12
components/qrcode/index.tsx

@ -45,7 +45,7 @@ const QRCode: React.FC<QRCodeProps> = (props) => {
width: iconSize,
excavate: true,
};
const qrCodeProps = {
value,
size: size - (token.paddingSM + token.lineWidth) * 2,
@ -53,8 +53,8 @@ const QRCode: React.FC<QRCodeProps> = (props) => {
bgColor,
fgColor: color,
imageSettings: icon ? imageSettings : undefined,
}
};
const [locale] = useLocale('QRCode');
if (!value) {
@ -93,11 +93,7 @@ const QRCode: React.FC<QRCodeProps> = (props) => {
)}
</div>
)}
{type === 'canvas' ? (
<QRCodeCanvas {...qrCodeProps} />
) : (
<QRCodeSVG {...qrCodeProps} />
)}
{type === 'canvas' ? <QRCodeCanvas {...qrCodeProps} /> : <QRCodeSVG {...qrCodeProps} />}
</div>,
);
};

2
components/qrcode/interface.ts

@ -21,7 +21,9 @@ export interface QRProps {
}
export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
export type QRPropsSvg = QRProps & React.SVGAttributes<SVGSVGElement>;
export interface QRCodeProps extends QRProps {
className?: string;
rootClassName?: string;

4
components/qrcode/style/index.ts

@ -1,6 +1,6 @@
import type { FullToken, GenerateStyle } from '../../theme/internal';
import { mergeToken, genComponentStyleHook } from '../../theme/internal';
import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle } from '../../theme/internal';
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
export interface ComponentToken {}

Loading…
Cancel
Save