header search icon styles fixed

This commit is contained in:
Igor Lobanov 2022-09-29 12:31:01 +02:00
parent 65fae2192d
commit 6688da72c0
3 changed files with 30 additions and 19 deletions

View File

@ -63,19 +63,6 @@
height: 80px; height: 80px;
} }
img {
height: 32px;
object-fit: contain;
object-position: left;
transition: height 0.2s;
vertical-align: middle;
width: 100px;
@include media-breakpoint-up(lg) {
width: 175px;
}
}
a { a {
border: none; border: none;
color: #000; color: #000;
@ -86,6 +73,19 @@
} }
} }
.searchIcon {
height: 32px;
object-fit: contain;
object-position: left;
transition: height 0.2s;
vertical-align: middle;
width: 100px;
@include media-breakpoint-up(lg) {
width: 175px;
}
}
.usernav { .usernav {
display: inline-flex; display: inline-flex;
padding-right: 0; padding-right: 0;

View File

@ -120,7 +120,7 @@ export const Header = (props: Props) => {
</For> </For>
<li class={styles.headerSearch}> <li class={styles.headerSearch}>
<a href="#"> <a href="#">
<Icon name="search" /> <Icon name="search" iconClassName={styles.searchIcon} />
{t('Search')} {t('Search')}
</a> </a>
</li> </li>

View File

@ -1,14 +1,25 @@
import clsx from 'clsx'
import { mergeProps, Show } from 'solid-js' import { mergeProps, Show } from 'solid-js'
import type { JSX } from 'solid-js'
import './Icon.css' import './Icon.css'
export const Icon = (_props: any) => { type IconProps = {
const props = mergeProps({ title: '', counter: 0 }, _props) className?: string
iconClassName?: string
style?: string | JSX.CSSProperties
title?: string
name?: string
counter?: number
}
export const Icon = (passedProps: IconProps) => {
const props = mergeProps({ title: '', counter: 0 }, passedProps)
return ( return (
<div class="icon" style={props.style}> <div class={clsx('icon', props.className)} style={props.style}>
<img src={`/icons/${props.name}.svg`} alt={props.title ?? props.name} /> <img src={`/icons/${props.name}.svg`} alt={props.title ?? props.name} class={props.iconClassName} />
<Show when={props.counter}> <Show when={props.counter}>
<div class="notifications-counter">{props.counter.toString()}</div> <div class="notifications-counter">{props.counter}</div>
</Show> </Show>
</div> </div>
) )