Skip to content

Commit

Permalink
fix: apply background pattern to card (#53)
Browse files Browse the repository at this point in the history
* fix: apply bacground pattern to card

* fix: ops console.log

* test: fix card test
  • Loading branch information
phoebus-84 authored Feb 17, 2024
1 parent 0385228 commit 8c0dc50
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
Binary file added src/components/assets/rect-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/components/assets/rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/credential-card/d-credential-card.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:host {
@apply w-full inline-flex flex-col items-start gap-2.5 px-5 py-5 rounded-lg bg-primary;
@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;
}

.between {
Expand Down
6 changes: 3 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, h } from '@stencil/core';
import { Component, Host, Prop, getAssetPath, 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,9 @@ export class DCredentialCard {
@Prop() expirationDate?: string;

render() {
// const imageSrc = getAssetPath(`./assets/Rectangle.png`);
const imageSrc = getAssetPath('./assets/rect-dark.png');
return (
<Host>
<Host style={{ 'background-image': `url(${imageSrc})` }}>
<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>
<d-credential-card style="background-image: url(/assets/rect-dark.png);">
<mock:shadow-root>
<div class="between">
<div class="info">
Expand Down
7 changes: 7 additions & 0 deletions stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export const config: Config = {
},
{
type: 'dist-custom-elements',
copy: [
{
src: '**/*.{jpg,png}',
dest: 'dist/didroom-components/assets',
warn: true,
}
],
generateTypeDeclarations: true,
},
{
Expand Down

0 comments on commit 8c0dc50

Please sign in to comment.