-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: eductx presentations display (#636)
Co-authored-by: martines3000 <[email protected]>
- Loading branch information
1 parent
932f6aa
commit 786b340
Showing
9 changed files
with
424 additions
and
197 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/dapp/src/app/[locale]/app/(public)/share-presentation/[id]/AddressDisplay.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,38 @@ | ||
import { formatAddress } from '@/utils/format'; | ||
import { copyToClipboard } from '@/utils/string'; | ||
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline'; | ||
import { Tooltip } from '@nextui-org/react'; | ||
import { useTranslations } from 'next-intl'; | ||
|
||
export const AddressDisplay = ({ address }: { address: string }) => { | ||
const t = useTranslations('AddressDisplay'); | ||
return ( | ||
<div className="flex flex-col space-y-0.5"> | ||
<h2 className="dark:text-navy-blue-200 pr-2 font-bold text-gray-800"> | ||
{t('title')}: | ||
</h2> | ||
<div className="flex"> | ||
<Tooltip | ||
className="border-navy-blue-300 bg-navy-blue-100 text-navy-blue-700" | ||
content={t('tooltip')} | ||
> | ||
<a | ||
href={`https://etherscan.io/address/${address}`} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-md animated-transition dark:text-navy-blue-300 cursor-pointer font-normal text-gray-700 underline underline-offset-2" | ||
> | ||
{formatAddress(address)} | ||
</a> | ||
</Tooltip> | ||
<button | ||
type="button" | ||
className="pl-1" | ||
onClick={() => copyToClipboard(address)} | ||
> | ||
<DocumentDuplicateIcon className="animated-transition dark:text-navy-blue-300 ml-1 h-5 w-5 text-gray-700 hover:text-gray-700" /> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
}; |
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
13 changes: 13 additions & 0 deletions
13
packages/dapp/src/app/[locale]/app/(public)/share-presentation/[id]/DisplayDate.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,13 @@ | ||
export const DisplayDate = ({ text, date }: { text: string; date: string }) => { | ||
const parsed = Date.parse(date); | ||
return ( | ||
<div className="flex flex-col items-start space-y-0.5"> | ||
<h2 className="dark:text-navy-blue-200 pr-2 font-bold text-gray-800"> | ||
{text}: | ||
</h2> | ||
<h3 className="text-md dark:text-navy-blue-200 text-gray-700"> | ||
{!Number.isNaN(parsed) ? new Date(parsed).toLocaleDateString() : date} | ||
</h3> | ||
</div> | ||
); | ||
}; |
25 changes: 25 additions & 0 deletions
25
packages/dapp/src/app/[locale]/app/(public)/share-presentation/[id]/DisplayText.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,25 @@ | ||
import { Tooltip } from '@nextui-org/react'; | ||
|
||
export const DisplayText = ({ | ||
text, | ||
value, | ||
tooltip, | ||
}: { text: string; value: string; tooltip?: string }) => ( | ||
<div className="flex flex-col items-start space-y-0.5"> | ||
<h2 className="dark:text-navy-blue-200 pr-2 font-bold text-gray-800"> | ||
{text}: | ||
</h2> | ||
{tooltip ? ( | ||
<Tooltip | ||
content={tooltip} | ||
className="border-navy-blue-300 bg-navy-blue-100 text-navy-blue-700" | ||
> | ||
<h3 className="text-md dark:text-navy-blue-200 text-gray-700"> | ||
{value} | ||
</h3> | ||
</Tooltip> | ||
) : ( | ||
<h3 className="text-md dark:text-navy-blue-200 text-gray-700">{value}</h3> | ||
)} | ||
</div> | ||
); |
Oops, something went wrong.