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: card background for both dark and light mode #57

Merged
merged 2 commits into from
Feb 20, 2024
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
3 changes: 2 additions & 1 deletion src/components/credential-card/d-credential-card.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:host {
@apply w-full inline-flex flex-col items-start gap-2.5 px-5 py-5 rounded-lg bg-primary bg-no-repeat bg-cover;
@apply w-full inline-flex flex-col items-start gap-2.5 px-5 py-5 rounded-lg bg-no-repeat bg-cover bg-gradient-to-r from-primary to-transparent;
background-image: var(--background-card-url);
}

.between {
Expand Down
5 changes: 2 additions & 3 deletions src/components/credential-card/d-credential-card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Host, Prop, getAssetPath, h } from '@stencil/core';
import { Component, Host, Prop, h } from '@stencil/core';

const verifiedUser = (
<svg width="22" height="21" viewBox="0 0 22 21" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down Expand Up @@ -43,9 +43,8 @@ export class DCredentialCard {
@Prop() expirationDate?: string;

render() {
const imageSrc = getAssetPath('./assets/rect-dark.png');
return (
<Host style={{ 'background-image': `url(${imageSrc})` }}>
<Host>
<div class="between">
<div class="info">
<div class="heading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('d-credential-card', () => {
html: `<d-credential-card></d-credential-card>`,
});
expect(page.root).toEqualHtml(`
<d-credential-card style="background-image: url(/assets/rect-dark.png);">
<d-credential-card>
<mock:shadow-root>
<div class="between">
<div class="info">
Expand Down
3 changes: 3 additions & 0 deletions src/global/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
--error: #ee342b;
--sans-font-family: 'Gantari Variable', 'sans-serif';
--icon-font-family: 'Material Symbols Rounded';
--background-card-url: url('/dist/didroom-components/assets/rect.png');
}

.dark {
Expand All @@ -38,6 +39,7 @@
--success: #4ecb71;
--warning: #ff9601;
--error: #ff443b;
--background-card-url: url('/dist/didroom-components/assets/rect-dark.png');
}

@media (prefers-color-scheme: dark) {
Expand All @@ -51,6 +53,7 @@
--success: #4ecb71;
--warning: #ff9601;
--error: #ff443b;
--background-card-url: url('/dist/didroom-components/assets/rect-dark.png');
}
}
}
Expand Down
Loading