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

feat(header): properly support the Icon interface #3421

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion src/components/header/examples/header-colors.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
:host(limel-example-header-colors) {
--header-background-color: rgb(var(--color-yellow-dark));
--header-icon-color: rgb(var(--color-white));
--header-heading-color: rgb(var(--color-brown-default));
--header-subheading-color: rgb(var(--color-brown-darker));
}
5 changes: 4 additions & 1 deletion src/components/header/examples/header-colors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export class HeaderExample {
public render() {
return (
<limel-header
icon="create_new"
icon={{
name: 'create_new',
color: 'rgb(var(--color-white))',
}}
heading="Edit note"
subheading="Created: 17 Jan 2023"
>
Expand Down
1 change: 0 additions & 1 deletion src/components/header/examples/header-narrow.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
:host(limel-example-header-narrow) {
--header-icon-color: rgb(var(--color-blue-default));
--header-top-right-left-border-radius: 0;
}
5 changes: 4 additions & 1 deletion src/components/header/examples/header-narrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export class HeaderExample {
return (
<limel-header
class="is-narrow"
icon="ok"
icon={{
name: 'ok',
color: 'rgb(var(--color-blue-default))',
}}
heading="This is a narrow header"
/>
);
Expand Down
12 changes: 8 additions & 4 deletions src/components/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* @prop --header-heading-color: Color of heading text, defaults to `--contrast-1100`.
* @prop --header-subheading-color: Color of subheading text, defaults to `--contrast-900`.
* @prop --header-supporting-text-color: Color of supporting text in subheading, defaults to `--header-subheading-color`.
* @prop --header-icon-color: Color of header icon, defaults to `--contrast-1100`.
* @prop --header-icon-background-color: Background color of header icon, defaults to `transparent`.
* @prop --header-top-right-left-border-radius: Top-left and top-right border radius of header, defaults to `0.75rem`.
* @prop --header-responsive-breakpoint: Defines the minimum allowed `width` of both information and actions areas in the header, defaults to `22rem`.
*/
Expand Down Expand Up @@ -36,8 +34,14 @@
.icon {
--limel-icon-svg-margin: 0.25rem;
flex-shrink: 0;
color: var(--header-icon-color, rgb(var(--contrast-1100)));
background-color: var(--header-icon-background-color, transparent);
color: var(
--limel-header-icon-color,
var(--header-icon-color, rgb(var(--contrast-1100)))
);
background-color: var(
--limel-header-icon-background-color,
var(--header-icon-background-color, transparent)
);
width: 2.25rem;
border-radius: 0.56rem;
}
Expand Down
15 changes: 14 additions & 1 deletion src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,20 @@ export class Header {
return;
}

return <limel-icon class="icon" badge={true} name={icon} />;
return (
<limel-icon
class="icon"
badge={true}
name={icon}
style={{
'--limel-header-icon-color': `${(this.icon as Icon)?.color ?? ''}`,
'--limel-header-icon-background-color': `${
(this.icon as Icon)?.backgroundColor ?? ''
}`,
title: `${(this.icon as Icon)?.title}`,
}}
/>
);
}

private renderSupportingText() {
Expand Down
Loading