Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply size to style directly to prevent warnings on size #901

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/widgets/src/dns-hole/summary/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const StatCard = ({ item, data, usePiHoleColors }: StatCardProps) => {
direction={isLong ? "row" : "column"}
style={{ containerType: "size" }}
>
<item.icon className="summary-card-icon" size="50cqmin" style={{ margin: "2cqmin" }} />
<item.icon className="summary-card-icon" style={{ margin: "2cqmin", height: "50cqmin", width: "50cqmin" }} />
<Flex
className="summary-card-texts"
justify="center"
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/rssFeed/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function RssFeed({ serverData, options }: WidgetComponentProps<"r

const InfoDisplay = ({ date }: { date: string }) => (
<Group gap="2.5cqmin">
<IconClock size="2.5cqmin" />
<IconClock style={{ height: "3cqmin", width: "3cqmin" }} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide more context why size doesn't work here and why you use the style attribute instead of height and width directly?

Copy link
Collaborator Author

@SeDemal SeDemal Aug 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SVG's don't officially support relative sizing, says so in it's spec. Browsers knows that, found it stupid and allows for relative sizing when using the component, but because it's not supposed to support it, it'll flood an error in the console of the browser. so to circumvent that, you need to set the size using the style parameter, which is anoying, especially since the size parameter exist but you just can't use it properly without it making a mess in the browser's logs. (Tabler icons directly apply the size parameter to the height/width parameter of the underlying icon svg, instead of passing it to the styling, so only icons are affected and need to be changed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we contribute this fix upstream then? (eg. Tabler Icons?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... I agree, just out of laziness I didn't want to bother. But since I don't know how long this will take, and I don't want my console to be flooded, I'd suggest we do this in the meantime.

<Text size="2.5cqmin" c="dimmed" pt="1cqmin">
{date}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/weather/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const WeeklyForecast = ({ options, weather }: WeatherProps) => {
<Group className="weather-forecast-city-temp-group" wrap="nowrap" gap="5cqmin">
{options.showCity && (
<>
<IconMapPin size="20cqmin" />
<IconMapPin style={{ height: "20cqmin", width: "20cqmin" }} />
<Text size="15cqmin" style={{ whiteSpace: "nowrap" }}>
{options.location.name}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/weather/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface WeatherIconProps {
export const WeatherIcon = ({ code, size = 50 }: WeatherIconProps) => {
const { icon: Icon } = weatherDefinitions.find((definition) => definition.codes.includes(code)) ?? unknownWeather;

return <Icon style={{ float: "left" }} size={size} />;
return <Icon style={{ float: "left", height: size, width: size }} />;
};

interface WeatherDescriptionProps {
Expand Down
Loading