Add icons to GridRep with tooltips
This commit is contained in:
parent
b78724beff
commit
f22f70ba23
4 changed files with 67 additions and 19 deletions
|
|
@ -241,6 +241,18 @@
|
||||||
gap: calc($unit / 2);
|
gap: calc($unit / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: $unit * 2.5;
|
||||||
|
height: $unit * 2.5;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
fill: var(--text-tertiary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
button svg {
|
button svg {
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,11 @@ import { accountState } from '~utils/accountState'
|
||||||
import { formatTimeAgo } from '~utils/timeAgo'
|
import { formatTimeAgo } from '~utils/timeAgo'
|
||||||
|
|
||||||
import Button from '~components/common/Button'
|
import Button from '~components/common/Button'
|
||||||
|
import Tooltip from '~components/common/Tooltip'
|
||||||
|
|
||||||
import SaveIcon from '~public/icons/Save.svg'
|
import SaveIcon from '~public/icons/Save.svg'
|
||||||
|
import PrivateIcon from '~public/icons/Private.svg'
|
||||||
|
import UnlistedIcon from '~public/icons/Unlisted.svg'
|
||||||
import ShieldIcon from '~public/icons/Shield.svg'
|
import ShieldIcon from '~public/icons/Shield.svg'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
|
|
@ -472,6 +475,48 @@ const GridRep = ({ party, loading, onClick, onSave }: Props) => {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const favoriteButton = (
|
||||||
|
<Link href="#">
|
||||||
|
<Button
|
||||||
|
className={classNames({
|
||||||
|
save: true,
|
||||||
|
saved: party.favorited,
|
||||||
|
})}
|
||||||
|
leftAccessoryIcon={<SaveIcon className="stroke" />}
|
||||||
|
active={party.favorited}
|
||||||
|
bound={true}
|
||||||
|
size="small"
|
||||||
|
onClick={sendSaveData}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
|
||||||
|
function buttonArea() {
|
||||||
|
if (
|
||||||
|
account.authorized &&
|
||||||
|
((party.user && account.user && account.user.id !== party.user.id) ||
|
||||||
|
!party.user)
|
||||||
|
) {
|
||||||
|
return favoriteButton
|
||||||
|
} else if (party.visibility === 2) {
|
||||||
|
return (
|
||||||
|
<Tooltip content={t('party.tooltips.unlisted')}>
|
||||||
|
<span className={styles.icon}>
|
||||||
|
<UnlistedIcon />
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
} else if (party.visibility === 3) {
|
||||||
|
return (
|
||||||
|
<Tooltip content={t('party.tooltips.private')}>
|
||||||
|
<span className={styles.icon}>
|
||||||
|
<PrivateIcon />
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const detailsWithUsername = (
|
const detailsWithUsername = (
|
||||||
<div className={styles.details}>
|
<div className={styles.details}>
|
||||||
<div className={styles.top}>
|
<div className={styles.top}>
|
||||||
|
|
@ -493,25 +538,7 @@ const GridRep = ({ party, loading, onClick, onSave }: Props) => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{account.authorized &&
|
{buttonArea()}
|
||||||
((party.user && account.user && account.user.id !== party.user.id) ||
|
|
||||||
!party.user) ? (
|
|
||||||
<Link href="#">
|
|
||||||
<Button
|
|
||||||
className={classNames({
|
|
||||||
save: true,
|
|
||||||
saved: party.favorited,
|
|
||||||
})}
|
|
||||||
leftAccessoryIcon={<SaveIcon className="stroke" />}
|
|
||||||
active={party.favorited}
|
|
||||||
bound={true}
|
|
||||||
size="small"
|
|
||||||
onClick={sendSaveData}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
''
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.attributed}>
|
<div className={styles.attributed}>
|
||||||
{attribution()}
|
{attribution()}
|
||||||
|
|
|
||||||
|
|
@ -499,6 +499,10 @@
|
||||||
"copy_link": "Copy link",
|
"copy_link": "Copy link",
|
||||||
"change_visibility": "Change visibility"
|
"change_visibility": "Change visibility"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tooltips": {
|
||||||
|
"unlisted": "This party is unlisted",
|
||||||
|
"private": "This party is private"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"proficiencies": {
|
"proficiencies": {
|
||||||
|
|
|
||||||
|
|
@ -487,6 +487,7 @@
|
||||||
"minutes": "分",
|
"minutes": "分",
|
||||||
"seconds": "秒"
|
"seconds": "秒"
|
||||||
},
|
},
|
||||||
|
|
||||||
"turns": {
|
"turns": {
|
||||||
"with_count_one": "{{count}}ターン",
|
"with_count_one": "{{count}}ターン",
|
||||||
"with_count_other": "{{count}}ターン"
|
"with_count_other": "{{count}}ターン"
|
||||||
|
|
@ -499,6 +500,10 @@
|
||||||
"copy_link": "リンクをコピー",
|
"copy_link": "リンクをコピー",
|
||||||
"change_visibility": "プライバシー設定を変更"
|
"change_visibility": "プライバシー設定を変更"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tooltips": {
|
||||||
|
"unlisted": "この編成は限定公開",
|
||||||
|
"private": "この編成は未公開"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"proficiencies": {
|
"proficiencies": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue