Skip to content

Commit

Permalink
fix: 🐛 fix upload component style
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingyun2010 committed Sep 17, 2021
1 parent 8b58ac8 commit 2b03a10
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
20 changes: 14 additions & 6 deletions components/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const CardFigure: React.FC<IFigureProps> = props => {
className,
)

const arstyle: any = {}

if (aspectRatio && aspectRatio > 0) {
arstyle.marginTop = `${(1 / aspectRatio) * 100}%`
}

return (
<figure {...otherProps} className={cls} onClick={onClick}>
{children && <div className="x-card__figure-content">{children}</div>}
Expand All @@ -33,9 +39,7 @@ const CardFigure: React.FC<IFigureProps> = props => {
alt={title}
title={title}
/>
{aspectRatio && aspectRatio > 0 ? (
<div className="x-card__ar" style={{ marginTop: `${(1 / aspectRatio) * 100}%` }} />
) : null}
{aspectRatio && aspectRatio > 0 ? <div className="x-card__ar" style={arstyle} /> : null}
</figure>
)
}
Expand Down Expand Up @@ -65,12 +69,16 @@ const Card: React.FC<ICardProps> & {
className,
)

const arstyle: any = {}

if (aspectRatio && aspectRatio > 0) {
arstyle.marginTop = `${(1 / aspectRatio) * 100}%`
}

return (
<div {...otherProps} className={cls} onClick={onClick}>
<div className={`x-card__inner x-card--${direction || 'column'}`}>{children}</div>
{aspectRatio && aspectRatio > 0 ? (
<div className="x-card__ar" style={{ marginTop: `${(1 / aspectRatio) * 100}%` }} />
) : null}
{aspectRatio && aspectRatio > 0 ? <div className="x-card__ar" style={arstyle} /> : null}
</div>
)
}
Expand Down
20 changes: 14 additions & 6 deletions examples_src/src/auto-ui/components/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const CardFigure: React.FC<IFigureProps> = props => {
className,
)

const arstyle: any = {}

if (aspectRatio && aspectRatio > 0) {
arstyle.marginTop = `${(1 / aspectRatio) * 100}%`
}

return (
<figure {...otherProps} className={cls} onClick={onClick}>
{children && <div className="x-card__figure-content">{children}</div>}
Expand All @@ -33,9 +39,7 @@ const CardFigure: React.FC<IFigureProps> = props => {
alt={title}
title={title}
/>
{aspectRatio && aspectRatio > 0 ? (
<div className="x-card__ar" style={{ marginTop: `${(1 / aspectRatio) * 100}%` }} />
) : null}
{aspectRatio && aspectRatio > 0 ? <div className="x-card__ar" style={arstyle} /> : null}
</figure>
)
}
Expand Down Expand Up @@ -65,12 +69,16 @@ const Card: React.FC<ICardProps> & {
className,
)

const arstyle: any = {}

if (aspectRatio && aspectRatio > 0) {
arstyle.marginTop = `${(1 / aspectRatio) * 100}%`
}

return (
<div {...otherProps} className={cls} onClick={onClick}>
<div className={`x-card__inner x-card--${direction || 'column'}`}>{children}</div>
{aspectRatio && aspectRatio > 0 ? (
<div className="x-card__ar" style={{ marginTop: `${(1 / aspectRatio) * 100}%` }} />
) : null}
{aspectRatio && aspectRatio > 0 ? <div className="x-card__ar" style={arstyle} /> : null}
</div>
)
}
Expand Down
1 change: 1 addition & 0 deletions scripts/componentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const componentList = [
'AtNav',
'AtCitySelector',
'Provider',
'Upload',
];

module.exports = componentList;

0 comments on commit 2b03a10

Please sign in to comment.