Skip to content

Commit

Permalink
fix: Image letter change error (#539)
Browse files Browse the repository at this point in the history
* fix: Table actions column style
  • Loading branch information
dongrui authored Nov 9, 2018
1 parent d5ef194 commit e6930a6
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/components/Base/Image/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class Image extends React.Component {
width: iconSize + 'px',
height: iconSize + 'px'
};
const letter = iconLetter[0].toLocaleUpperCase();
const letter = iconLetter.substr(0, 1).toLocaleUpperCase();

if (letter) {
style.fontSize = iconSize / 2 + 'px';
Expand Down
6 changes: 2 additions & 4 deletions src/components/Base/Table/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@
letter-spacing: 0;
background-color: $N10;

&:last-child{
&.actions {
text-align: center;
}

&::before {
content: "";
position: absolute;
Expand Down Expand Up @@ -155,9 +156,6 @@

&:last-child {
//border-right: 48px solid #fff;
[class*='TimeShow'] {
text-align: center;
}
}

}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Card/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Card extends PureComponent {
render() {
const { icon, name, desc, fold } = this.props;
const iconSize = fold ? 36 : 48;
const noneIcon = '/none.svg';

return (
<div
Expand All @@ -34,7 +33,7 @@ class Card extends PureComponent {
>
<div className={styles.title}>
<span className={styles.icon}>
<Image src={icon || noneIcon} alt="Icon" iconSize={iconSize} />
<Image src={icon} alt="Icon" iconSize={iconSize} iconLetter={name} />
</span>
<p className={styles.name}>{name}</p>
<p className={classnames(styles.desc, { [styles.hide]: !fold })} title={desc}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/TitleBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class TitleBanner extends Component {
<div className={styles.wrapper}>
{hasImage && (
<span className={styles.image}>
<Image src={detail.icon} iconSize={48} />
<Image src={detail.icon} iconSize={48} iconLetter={detail.name} />
</span>
)}
{type === 'runtimeDetail' && (
Expand Down
4 changes: 1 addition & 3 deletions src/pages/AppDetail/Meta/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { get } from 'lodash';
import styles from './index.scss';

const Meta = ({ app }) => {
const iconSrc = '/none.svg';

return (
<div className={styles.meta}>
<span className={styles.icon}>
<Image src={app.icon || iconSrc} iconSize={48} />
<Image src={app.icon} iconSize={48} iconLetter={app.name} />
</span>
<div className={styles.title}>
{app.name}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/Apps/Deploy/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default class AppDeploy extends Component {
return (
<div className={styles.aside}>
<div className={styles.appIntro}>
<Image src={appDetail.icon} className={styles.icon} />
<Image src={appDetail.icon} className={styles.icon} iconLetter={appDetail.name} />
<span className={styles.name}>{appDetail.name}</span>
</div>
<p>{t('Deploy App explain')}</p>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/Apps/Detail/DetailBlock/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class DetailBlock extends React.Component {
<div className={styles.detailBlock}>
<div className={styles.titleOuter}>
<span className={styles.icon}>
<Image src={appDetail.icon} alt="Icon" iconSize={32} />
<Image src={appDetail.icon} alt="Icon" iconSize={32} iconLetter={appDetail.name} />
</span>
<div className={styles.title}>
<div className={styles.name}>{appDetail.name}</div>
Expand Down
9 changes: 4 additions & 5 deletions src/pages/Dashboard/Apps/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,11 @@ export default class Apps extends Component {
title: t('Actions'),
key: 'actions',
width: '84px',
className: 'actions',
render: item => (
<div className={styles.actions}>
<Popover content={this.renderHandleMenu(item)} className="actions">
<Icon name="more" />
</Popover>
</div>
<Popover content={this.renderHandleMenu(item)} className="actions">
<Icon name="more" />
</Popover>
)
}
];
Expand Down
11 changes: 5 additions & 6 deletions src/pages/Dashboard/Clusters/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,11 @@ export default class Clusters extends Component {
title: t('Actions'),
key: 'actions',
width: '84px',
render: (text, cl) => (
<div className={styles.actions}>
<Popover content={this.renderHandleMenu(cl)} className="actions">
<Icon name="more" />
</Popover>
</div>
className: 'actions',
render: cl => (
<Popover content={this.renderHandleMenu(cl)} className="actions">
<Icon name="more" />
</Popover>
)
}
];
Expand Down
1 change: 1 addition & 0 deletions src/pages/Dashboard/Repos/Detail/tabs/runtime-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function(clusters, users) {
name={item.name}
description={item.runtime_id}
linkUrl={`/dashboard/runtime/${item.runtime_id}`}
noIcon
/>
)
},
Expand Down
11 changes: 5 additions & 6 deletions src/pages/Dashboard/Runtimes/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ export default class Runtimes extends Component {
title: t('Actions'),
key: 'actions',
width: '84px',
render: (text, item) => (
<div className={styles.actions}>
<Popover content={this.renderHandleMenu(item)} className="actions">
<Icon name="more" />
</Popover>
</div>
className: 'actions',
render: runtime => (
<Popover content={this.renderHandleMenu(runtime)} className="actions">
<Icon name="more" />
</Popover>
)
}
];
Expand Down
1 change: 1 addition & 0 deletions src/pages/Dashboard/Users/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export default class Users extends Component {
title: t('Actions'),
key: 'actions',
width: '84px',
className: 'actions',
render: item => (
<Popover content={this.renderHandleMenu(item)} className="actions">
<Icon name="more" />
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Purchased/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class Purchased extends Component {
onClick={() => this.selectClusters(app.app_id)}
>
<span className={styles.image}>
<Image src={app.icon} iconSize={36} />
<Image src={app.icon} iconSize={36} iconLetter={app.name} />
</span>
<div className={styles.word}>
<div className={styles.name}>{app.name}</div>
Expand Down Expand Up @@ -269,6 +269,7 @@ export default class Purchased extends Component {
title: t('Actions'),
key: 'actions',
width: '84px',
className: 'actions',
render: item => (
<Popover content={this.renderHandleMenu(item)} className="actions">
<Icon name="more" />
Expand Down
1 change: 1 addition & 0 deletions src/utils/columns/runtime-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default clusters => {
name={item.name}
description={item.runtime_id}
linkUrl={`/dashboard/runtime/${item.runtime_id}`}
noIcon
/>
)
},
Expand Down

0 comments on commit e6930a6

Please sign in to comment.