mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
refactor: migrate filter item and section styles from VE to SCSS + BEM
This commit is contained in:
parent
86d7ced0c0
commit
b855abbab0
@ -1,5 +1,5 @@
|
||||
import { vars } from "@renderer/theme.css";
|
||||
import { XIcon } from "@primer/octicons-react";
|
||||
import "./filter.scss";
|
||||
|
||||
interface FilterItemProps {
|
||||
filter: string;
|
||||
@ -9,39 +9,13 @@ interface FilterItemProps {
|
||||
|
||||
export function FilterItem({ filter, orbColor, onRemove }: FilterItemProps) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
color: vars.color.body,
|
||||
backgroundColor: vars.color.darkBackground,
|
||||
padding: "6px 12px",
|
||||
borderRadius: 4,
|
||||
border: `solid 1px ${vars.color.border}`,
|
||||
fontSize: 12,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: 10,
|
||||
height: 10,
|
||||
backgroundColor: orbColor,
|
||||
borderRadius: "50%",
|
||||
marginRight: 8,
|
||||
}}
|
||||
/>
|
||||
<div className="filter-item">
|
||||
<div className="filter-item__orb" style={{ backgroundColor: orbColor }} />
|
||||
{filter}
|
||||
<button
|
||||
type="button"
|
||||
onClick={onRemove}
|
||||
style={{
|
||||
color: vars.color.body,
|
||||
marginLeft: 4,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
className="filter-item__remove-button"
|
||||
>
|
||||
<XIcon size={13} />
|
||||
</button>
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { CheckboxField, TextField } from "@renderer/components";
|
||||
import { useFormat } from "@renderer/hooks";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
|
||||
import "./filter.scss";
|
||||
import List from "rc-virtual-list";
|
||||
import { vars } from "@renderer/theme.css";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export interface FilterSectionProps {
|
||||
@ -54,36 +53,18 @@ export function FilterSection({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ display: "flex", gap: 8, alignItems: "center" }}>
|
||||
<div className="filter-section__header">
|
||||
<div
|
||||
style={{
|
||||
width: 10,
|
||||
height: 10,
|
||||
backgroundColor: color,
|
||||
borderRadius: "50%",
|
||||
}}
|
||||
className="filter-section__orb"
|
||||
style={{ backgroundColor: color }}
|
||||
/>
|
||||
<h3
|
||||
style={{
|
||||
fontSize: 16,
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</h3>
|
||||
<h3 className="filter-section__title">{title}</h3>
|
||||
</div>
|
||||
|
||||
{selectedItemsCount > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
style={{
|
||||
fontSize: 12,
|
||||
marginBottom: 12,
|
||||
display: "block",
|
||||
color: vars.color.body,
|
||||
cursor: "pointer",
|
||||
textDecoration: "underline",
|
||||
}}
|
||||
className="filter-section__clear-button"
|
||||
onClick={onClear}
|
||||
>
|
||||
{t("clear_filters", {
|
||||
@ -91,7 +72,7 @@ export function FilterSection({
|
||||
})}
|
||||
</button>
|
||||
) : (
|
||||
<span style={{ fontSize: 12, marginBottom: 12, display: "block" }}>
|
||||
<span className="filter-section__count">
|
||||
{t("filter_count", {
|
||||
filterCount: formatNumber(items.length),
|
||||
})}
|
||||
@ -102,7 +83,7 @@ export function FilterSection({
|
||||
placeholder={t("search")}
|
||||
onChange={(e) => onSearch(e.target.value)}
|
||||
value={search}
|
||||
containerProps={{ style: { marginBottom: 16 } }}
|
||||
containerProps={{ className: "filter-section__search" }}
|
||||
theme="dark"
|
||||
/>
|
||||
|
||||
@ -122,7 +103,7 @@ export function FilterSection({
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<div key={item.value} style={{ height: 28, maxHeight: 28 }}>
|
||||
<div key={item.value} className="filter-section__item">
|
||||
<CheckboxField
|
||||
label={item.label}
|
||||
checked={item.checked}
|
||||
|
71
src/renderer/src/pages/catalogue/filter.scss
Normal file
71
src/renderer/src/pages/catalogue/filter.scss
Normal file
@ -0,0 +1,71 @@
|
||||
@use "../../scss/globals.scss";
|
||||
|
||||
.filter-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: globals.$body-color;
|
||||
background-color: globals.$dark-background-color;
|
||||
padding: 6px 12px;
|
||||
border-radius: 4px;
|
||||
border: solid 1px globals.$border-color;
|
||||
font-size: 12px;
|
||||
|
||||
&__orb {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
&__remove-button {
|
||||
color: globals.$body-color;
|
||||
margin-left: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
&__header {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__orb {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&__count {
|
||||
font-size: 12px;
|
||||
margin-bottom: 12px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&__clear-button {
|
||||
font-size: 12px;
|
||||
margin-bottom: 12px;
|
||||
display: block;
|
||||
color: globals.$body-color;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&__search {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
&__item {
|
||||
height: 28px;
|
||||
max-height: 28px;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user