Skip to content

Commit

Permalink
css fix
Browse files Browse the repository at this point in the history
  • Loading branch information
insxnsive committed Jan 18, 2025
1 parent d50bb13 commit ee0e314
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 120 deletions.
2 changes: 1 addition & 1 deletion src/locales/pt-BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"featured": "Destaques",
"hot": "Populares",
"weekly": "📅 Mais baixados da semana",
"achievements": "🏆 Pra platinar",
"achievements": "🏆 Para platinar",
"surprise_me": "Surpreenda-me",
"no_results": "Nenhum resultado encontrado",
"start_typing": "Comece a digitar para pesquisar…"
Expand Down
62 changes: 31 additions & 31 deletions src/renderer/src/components/text-field/text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,47 @@
border-color: vars.$danger-color;
}

&__focused {
&--focused {
border-color: vars.$search-border-color-focused;
}

&:not(&--focused):hover {
border-color: vars.$search-border-color-hover;
}
}

.text-field__input {
background-color: transparent;
border: none;
width: 100%;
height: 100%;
outline: none;
color: vars.$search-input-color;
cursor: default;
font-family: inherit;
text-overflow: ellipsis;
padding: vars.$spacing-unit;
&__input {
background-color: transparent;
border: none;
width: 100%;
height: 100%;
outline: none;
color: vars.$search-input-color;
cursor: default;
font-family: inherit;
text-overflow: ellipsis;
padding: vars.$spacing-unit;

&:focus {
cursor: text;
}
&:focus {
cursor: text;
}

&__read-only {
text-overflow: inherit;
&__read-only {
text-overflow: inherit;
}
}
}

.text-field__toggle-password-button {
cursor: pointer;
color: vars.$muted-color;
padding: vars.$spacing-unit;
}
&__toggle-password-button {
cursor: pointer;
color: vars.$muted-color;
padding: vars.$spacing-unit;
}

.text-field__wrapper {
display: flex;
gap: vars.$spacing-unit;
}
&__wrapper {
display: flex;
gap: vars.$spacing-unit;
}

.text-field__error-label {
color: vars.$danger-color;
}
&__error-label {
color: vars.$danger-color;
}
}
28 changes: 10 additions & 18 deletions src/renderer/src/components/text-field/text-field.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useId, useMemo, useState } from "react";
import { EyeClosedIcon, EyeIcon } from "@primer/octicons-react";
import { useTranslation } from "react-i18next";

import cn from "classnames";

import "./text-field.scss";
Expand Down Expand Up @@ -42,9 +41,7 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
) => {
const id = useId();
const [isFocused, setIsFocused] = useState(false);

const [isPasswordVisible, setIsPasswordVisible] = useState(false);

const { t } = useTranslation("forms");

const showPasswordToggleButton = props.type === "password";
Expand All @@ -57,7 +54,7 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
const hintContent = useMemo(() => {
if (error && typeof error === "object" && "message" in error)
return (
<small className="text-field-container__error-label">
<small className="text-field__error-label">
{error.message as string}
</small>
);
Expand All @@ -82,24 +79,19 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
<div className="text-field-container" {...containerProps}>
{label && <label htmlFor={id}>{label}</label>}

<div className="text-field-container__text-field-wrapper">
<div className="text-field__wrapper">
<div
className={cn(
"text-field-container__text-field",
`text-field-container__text-field--${theme}`,
{
"text-field-container__text-field__has-error": hasError,
"text-field-container__text-field__focused": isFocused,
}
)}
className={cn("text-field", `text-field__${theme}`, {
"text-field__has-error": hasError,
"text-field--focused": isFocused,
})}
{...textFieldProps}
>
<input
ref={ref}
id={id}
className={cn("text-field-container__text-field-input", {
"text-field-container__text-field-input__read-only":
props.readOnly,
className={cn("text-field__input", {
"text-field__input__read-only": props.readOnly,
})}
{...props}
onFocus={handleFocus}
Expand All @@ -110,7 +102,7 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
{showPasswordToggleButton && (
<button
type="button"
className="text-field-container__toggle-password-button"
className="text-field__toggle-password-button"
onClick={() => setIsPasswordVisible(!isPasswordVisible)}
aria-label={t("toggle_password_visibility")}
>
Expand All @@ -132,4 +124,4 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
}
);

TextField.displayName = "TextField";
TextField.displayName = "TextField";
2 changes: 1 addition & 1 deletion src/renderer/src/pages/achievements/achievements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function Achievements() {
(otherUserId && comparedAchievements === null);

return (
<SkeletonTheme baseColor="#1c1c1c" highlightColor="#444">
<SkeletonTheme baseColor="var(--background-color)" highlightColor="#444">
{showSkeleton ? (
<AchievementsSkeleton />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.sidebar-section {
&__button {
height: 72px;
padding: #{vars.$spacing-unit * 2};
padding: #{vars.$spacing-unit * 2} #{vars.$spacing-unit * 2};
display: flex;
align-items: center;
background-color: vars.$background-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function SidebarSection({ title, children }: SidebarSectionProps) {
>
<ChevronDownIcon
className={classNames("chevron", {
"chevron--open": isOpen,
"sidebar-section__chevron--open": isOpen,
})}
/>
<span>{title}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export function HowLongToBeatSection({
className="sidebar__how-long-to-beat-category"
>
<p
className="sidebar__how-long-to-beat-category"
className="sidebar__how-long-to-beat-category-label"
style={{
fontWeight: "bold",
}}
>
{category.title}
</p>

<p className="sidebar__how-long-to-beat-category">
<p className="sidebar__how-long-to-beat-category-label">
{getDuration(category.duration)}
</p>

Expand Down
Loading

0 comments on commit ee0e314

Please sign in to comment.