mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: align item with icon
This commit is contained in:
parent
4ac447be2e
commit
255aa7eb1d
3 changed files with 7 additions and 4 deletions
|
|
@ -120,10 +120,12 @@ function getSVGIconComponent(
|
|||
type Props = {
|
||||
type: string
|
||||
className?: string
|
||||
placeholder?: boolean
|
||||
onClick?: (event: React.MouseEvent<HTMLElement>) => void
|
||||
}
|
||||
|
||||
export function Icon({ type, className = undefined, ...otherProps }: Props) {
|
||||
export function Icon({ type, className = undefined, placeholder, ...otherProps }: Props) {
|
||||
if (placeholder) return <div className={cx('octicon-wrapper')} />
|
||||
const { name, IconComponent } = getSVGIconComponent(type)
|
||||
const mergedClassName = cx('octicon', name)
|
||||
return (
|
||||
|
|
@ -131,6 +133,7 @@ export function Icon({ type, className = undefined, ...otherProps }: Props) {
|
|||
{React.createElement(Octicon, {
|
||||
icon: IconComponent,
|
||||
className: mergedClassName,
|
||||
verticalAlign: 'middle',
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ const NodeItemIcon = React.memo(function NodeItemIcon({
|
|||
)
|
||||
return (
|
||||
<>
|
||||
{node.type !== 'blob' && <Icon type={getIconType(node)} />}
|
||||
<img alt={node.name} className={'node-item-icon'} src={src} />
|
||||
<Icon placeholder={node.type === 'blob'} type={getIconType(node)} />
|
||||
{node.type !== 'commit' && <img alt={node.name} className={'node-item-icon'} src={src} />}
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@
|
|||
height: 16px;
|
||||
object-fit: contain;
|
||||
vertical-align: middle;
|
||||
padding-left: 6px;
|
||||
padding-left: 4px;
|
||||
box-sizing: content-box;
|
||||
|
||||
&.dim {
|
||||
|
|
|
|||
Loading…
Reference in a new issue