-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #330 from Concordium/display-credentials
Display credentials
- Loading branch information
Showing
28 changed files
with
1,464 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
packages/browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredential.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
.verifiable-credential-list { | ||
overflow-y: auto; | ||
} | ||
|
||
.verifiable-credential { | ||
color: $color-white; | ||
border-radius: rem(16px); | ||
margin: rem(16px); | ||
box-shadow: rgb(99 99 99 / 20%) rem(0) rem(2px) rem(8px) rem(0); | ||
position: relative; | ||
|
||
&__header { | ||
display: flex; | ||
align-items: center; | ||
height: 62px; | ||
|
||
&__logo { | ||
flex-shrink: 0; | ||
margin-left: rem(11px); | ||
width: rem(28px); | ||
height: rem(28px); | ||
|
||
svg { | ||
path { | ||
fill: $color-white; | ||
} | ||
} | ||
} | ||
|
||
&__title { | ||
font-size: rem(10px); | ||
margin-left: rem(7px); | ||
} | ||
|
||
&__status { | ||
display: flex; | ||
font-size: rem(8px); | ||
color: $color-white; | ||
margin-right: rem(11px); | ||
margin-left: auto; | ||
align-items: center; | ||
|
||
svg { | ||
margin-left: rem(5px); | ||
} | ||
|
||
path { | ||
fill: $color-white; | ||
} | ||
} | ||
} | ||
|
||
&__image { | ||
margin-left: rem(8px); | ||
margin-right: rem(8px); | ||
height: 120px; | ||
width: 308px; | ||
|
||
img { | ||
max-width: 100%; | ||
max-height: 100%; | ||
} | ||
} | ||
|
||
&__body-attributes { | ||
padding: rem(11px); | ||
|
||
&-row { | ||
&:not(:last-child) { | ||
margin-bottom: rem(10px); | ||
} | ||
|
||
label { | ||
color: $color-white; | ||
opacity: 0.5; | ||
font-size: rem(9px); | ||
font-variant: small-caps; | ||
display: block; | ||
} | ||
|
||
&-value { | ||
display: block; | ||
font-size: rem(10px); | ||
font-weight: $font-weight-light; | ||
} | ||
} | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
.../browser-wallet/src/popup/pages/VerifiableCredential/VerifiableCredentialCard.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* eslint-disable react/function-component-definition, react/destructuring-assignment */ | ||
import React from 'react'; | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import { VerifiableCredentialSchema, VerifiableCredentialStatus } from '@shared/storage/types'; | ||
import { VerifiableCredentialMetadata } from '@shared/utils/verifiable-credential-helpers'; | ||
import { VerifiableCredentialCard } from './VerifiableCredentialCard'; | ||
|
||
export default { | ||
title: 'VerifiableCredential/VerifiableCredentialCard', | ||
component: VerifiableCredentialCard, | ||
} as ComponentMeta<typeof VerifiableCredentialCard>; | ||
|
||
const schema: VerifiableCredentialSchema = { | ||
$id: 'https://example-university.com/certificates/JsonSchema2023-education-certificate.json', | ||
$schema: 'https://json-schema.org/draft/2020-12/schema', | ||
name: 'Education certificate', | ||
description: 'Simple representation of an education certificate.', | ||
type: 'object', | ||
properties: { | ||
credentialSubject: { | ||
type: 'object', | ||
properties: { | ||
id: { | ||
title: 'Credential subject id', | ||
type: 'string', | ||
description: 'Credential subject identifier', | ||
}, | ||
degreeType: { | ||
title: 'Degree Hello', | ||
type: 'string', | ||
description: 'Degree type', | ||
}, | ||
degreeName: { | ||
title: 'Degree name', | ||
type: 'string', | ||
description: 'Degree name', | ||
}, | ||
graduationDate: { | ||
title: 'Graduation date', | ||
type: 'string', | ||
format: 'date-time', | ||
description: 'Graduation date', | ||
}, | ||
}, | ||
required: ['id', 'degreeType', 'degreeName', 'graduationDate'], | ||
}, | ||
}, | ||
required: ['credentialSubject'], | ||
}; | ||
|
||
const metadata: VerifiableCredentialMetadata = { | ||
title: 'Education Certificate v2', | ||
logo: { | ||
url: 'https://img.logoipsum.com/298.svg', | ||
hash: '1c74f7eb1b3343a5834e60e9a8fce277f2c7553112accd42e63fae7a09e0caf8', | ||
}, | ||
background_color: '#003d73', | ||
image: { | ||
url: 'https://picsum.photos/327/120', | ||
}, | ||
localization: { | ||
'da-DK': { | ||
url: 'https://location.of/the/danish/metadata.json', | ||
hash: '624a1a7e51f7a87effbf8261426cb7d436cf597be327ebbf113e62cb7814a34b', | ||
}, | ||
}, | ||
}; | ||
|
||
const verifiableCredential = { | ||
'@context': ['https://www.w3.org/2018/credentials/v1', 'Concordium VC URI'], | ||
id: 'did:ccd:NETWORK:sci:INDEX:SUBINDEX/credentialEntry/ff4aa77af80b4d72973ccb957d180746', | ||
type: ['VerifiableCredential', 'UniversityDegreeCredential'], | ||
issuer: 'did:ccd:NETWORK:sci:INDEX:SUBINDEX/issuer', | ||
issuanceDate: '2010-01-01T00:00:00Z', | ||
credentialSubject: { | ||
id: 'did:ccd:pkc:ebfeb1f712ebc6f1c276e12ec21', | ||
degreeType: 'Bachelor degree', | ||
degreeName: 'Bachelor of Science and Arts', | ||
graduationDate: '2010-06-01T00:00:00Z', | ||
}, | ||
credentialSchema: { | ||
id: 'https://example-university.com/certificates/simple-education-certificate.json', | ||
type: 'CredentialSchema2022', // the same for all schemas | ||
}, | ||
}; | ||
|
||
export const Primary: ComponentStory<typeof VerifiableCredentialCard> = () => { | ||
return ( | ||
<div style={{ width: 375 }}> | ||
<VerifiableCredentialCard | ||
credential={verifiableCredential} | ||
schema={schema} | ||
credentialStatus={VerifiableCredentialStatus.Active} | ||
metadata={metadata} | ||
/> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.