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: design system ui updates #177

Merged
merged 1 commit into from
Oct 16, 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
4 changes: 1 addition & 3 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const minifiedLockdownSource = path.join(

const filesFromPackages = [
{
source: require.resolve(
'@metamask/design-tokens/src/css/design-tokens.css',
),
source: require.resolve('@metamask/design-tokens/styles.css'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating for design tokens v4

filename: 'design-tokens.css',
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test": "yarn playwright test"
},
"dependencies": {
"@metamask/design-tokens": "^1.12.0",
"@metamask/design-tokens": "^4.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading design tokens to latest. No breaking changes with CSS variables used in phishing detect https://github.com/MetaMask/design-tokens/blob/main/MIGRATION.md#from-version-300-to-400

"@metamask/object-multiplex": "^2.0.0",
"@metamask/post-message-stream": "^8.0.0",
"eth-phishing-detect": "^1.2.0",
Expand Down
134 changes: 49 additions & 85 deletions static/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ html {
}

body {
background-color: black;
background-color: var(--color-background-alternative);
height: 100%;
display: flex;
align-items: center;
Expand All @@ -40,7 +40,7 @@ body {
font-size: var(--typography-s-body-md-font-size);
line-height: var(--typography-s-body-md-line-height);
letter-spacing: var(--typography-s-body-md-letter-spacing);
color: var(--color-error-inverse);
color: var(--color-text-default);
}

@media screen and (min-width: 768px) {
Expand Down Expand Up @@ -73,56 +73,80 @@ body {

a {
text-decoration: underline;
color: var(--color-error-inverse);
color: var(--color-primary-default);
cursor: pointer;
}

ul {
padding-left: 32px;
}

.button-secondary {
color: var(--color-primary-default);
background: var(--color-background-default);
.button-primary {
color: var(--color-background-default);
background: var(--color-primary-default);
border: 1px solid var(--color-primary-default);
padding-right: 16px;
padding-left: 16px;
border-radius: 9999px;
height: 48px;
display: flex;
align-items: center;
margin-top: 48px;
font-weight: var(--typography-l-body-md-medium-font-weight);
font-family: var(--typography-s-body-md-font-family);
font-weight: var(--typography-s-body-md-font-weight);
font-size: var(--typography-s-body-md-font-size);
line-height: var(--typography-s-body-md-line-height);
letter-spacing: var(--typography-s-body-md-letter-spacing);
cursor: pointer;
margin-left: auto;
}

@media screen and (min-width: 768px) {
.button-secondary {
font-family: var(--typography-l-body-md-font-family);
font-weight: var(--typography-l-body-md-font-weight);
.button-primary {
font-weight: var(--typography-l-body-md-medium-font-weight);
font-family: var(--typography-s-body-md-font-family);
font-weight: var(--typography-s-body-md-font-weight);
font-size: var(--typography-l-body-md-font-size);
line-height: var(--typography-l-body-md-line-height);
letter-spacing: var(--typography-l-body-md-letter-spacing);
}
}

.button-secondary:hover {
.button-primary:hover {
color: var(--color-primary-inverse);
background-color: var(--color-primary-default);
box-shadow: var(--component-button-primary-shadow);
}

.button-secondary:active {
.button-primary:active {
color: var(--color-primary-inverse);
background-color: var(--color-primary-alternative);
border-color: var(--color-primary-alternative);
}

.button-link-danger {
color: var(--color-error-default);
background: transparent;
border: none;
padding-right: 16px;
padding-left: 16px;
cursor: pointer;
font-weight: var(--font-weight-medium);
font-family: var(--typography-s-body-md-font-family);
font-weight: var(--typography-s-body-md-font-weight);
font-size: var(--typography-s-body-md-font-size);
line-height: var(--typography-s-body-md-line-height);
letter-spacing: var(--typography-s-body-md-letter-spacing);
}

@media screen and (min-width: 768px) {
.button-link-danger {
font-weight: var(--font-weight-medium);
font-family: var(--typography-s-body-md-font-family);
font-weight: var(--typography-s-body-md-font-weight);
font-size: var(--typography-l-body-md-font-size);
line-height: var(--typography-l-body-md-line-height);
}
}

.content {
display: flex;
flex-direction: column;
Expand All @@ -139,22 +163,10 @@ ul {
margin-bottom: 16px;
}

.header-title {
font-family: var(--typography-s-heading-lg-font-family);
font-weight: var(--typography-s-heading-lg-font-weight);
font-size: var(--typography-s-heading-lg-font-size);
line-height: var(--typography-s-heading-lg-line-height);
letter-spacing: var(--typography-s-heading-lg-letter-spacing);
}

@media screen and (min-width: 768px) {
.header-title {
font-family: var(--typography-l-heading-lg-font-family);
font-weight: var(--typography-l-heading-lg-font-weight);
font-size: var(--typography-l-heading-lg-font-size);
line-height: var(--typography-l-heading-lg-line-height);
letter-spacing: var(--typography-l-heading-lg-letter-spacing);
}
.content__body {
display: flex;
flex-direction: column;
gap: 16px;
}

.warning-icon {
Expand All @@ -164,78 +176,30 @@ ul {
}

.alert-text {
color: #b4b4b4;
margin-bottom: 16px;
color: var(--color-text-alternative);
}

.alert-text-lists {
color: #b4b4b4;
color: var(--color-text-alternative);
}

.threat-list {
color: #b4b4b4;
color: var(--color-text-alternative);
}

.button-container {
display: flex;
}

.custom-button {
display: inline-block;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
text-align: center;
cursor: pointer;
margin: 10px;
}

.custom-proceed-button {
display: inline-block;
padding: 12px 12px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
text-align: center;
cursor: pointer;
margin: 10px;
}

.dashboard-button {
background-color: #00ff00;
color: black;
border: none;
font-weight: 600;
}

.proceed-button {
background-color: transparent;
color: #ffffff;
border: none;
font-weight: normal;
}

.custom-button:hover {
opacity: 0.8;
}

.spacer {
height: 16px;
}

.spacer-larger {
height: 48px;
Comment on lines -183 to -228
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing unused CSS classnames

gap: 16px;
}

.twitter-share-container {
display: flex;
align-items: center;
gap: 10px;
gap: 10px;
}

.twitter-share {
color: white;
color: var(--color-primary-default);
cursor: pointer;
text-decoration: none;
}
Expand All @@ -245,7 +209,7 @@ ul {
}

.twitter-icon {
width: 24px;
width: 24px;
height: auto;
}

Expand Down
86 changes: 54 additions & 32 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-theme="dark">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locks phishing page to dark mode

<head>
<style id="antiClickjack">
#content__body {
Expand All @@ -13,74 +13,96 @@
}
</script>
<title>MetaMask Phishing Detection</title>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-more.js" type="text/javascript" charset="utf-8"></script>
<script
src="./lockdown-install.js"
type="text/javascript"
charset="utf-8"
></script>
<script
src="./lockdown-run.js"
type="text/javascript"
charset="utf-8"
></script>
<script
src="./lockdown-more.js"
type="text/javascript"
charset="utf-8"
></script>
<script src="./bundle.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="./design-tokens.css">
<link rel="stylesheet" type="text/css" href="./index.css">
<link rel="icon" href="./favicon.ico" sizes="any">
<link rel="icon" href="./metamask-fox.svg" type="image/svg+xml">
<link rel="stylesheet" type="text/css" href="./design-tokens.css" />
<link rel="stylesheet" type="text/css" href="./index.css" />
<link rel="icon" href="./favicon.ico" sizes="any" />
<link rel="icon" href="./metamask-fox.svg" type="image/svg+xml" />
</head>
<body>
<div class="content">
<div class="content__header">
<img src="./warning-icon.svg" alt="Warning Icon" class="warning-icon" />
<h1 class="header-title">
This website might be harmful
</h1>
<h1 class="heading-lg">This website might be harmful</h1>
</div>
<div id="content__body" class="content__body">
<p class="alert-text">
MetaMask flagged the site you're trying to visit as potentially deceptive. Attackers may trick you into doing something dangerous.
MetaMask flagged the site you're trying to visit as potentially
deceptive. Attackers may trick you into doing something dangerous.
</p>

<p class="alert-text-lists">Potential threats on <span id="suspect-link"></span> include:</p>
<p class="alert-text-lists">
Potential threats on <span id="suspect-link"></span> include:
</p>
<ul class="threat-list">
<li>Secret Recovery Phrase or password theft</li>
<li>Malicious transactions resulting in stolen assets</li>
<li id="detection-repo">Listed on the blocklists of SEAL, ChainPatrol, or MetaMask</li>
<li id="detection-repo">
Listed on the blocklists of SEAL, ChainPatrol, or MetaMask
</li>
</ul>

<div class="spacer"></div>

<div class="button-container">
<button class="custom-button dashboard-button" id="portfolio-link">Back to safety</button>
<button class="custom-proceed-button proceed-button" id="unsafe-continue">Proceed anyway</button>
</div>
<button class="button-primary" id="portfolio-link" data-theme="light">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locks button to light mode to adhere to design system standards

Back to safety
</button>

<div class="spacer"></div>
<button class="button-link-danger" id="unsafe-continue">
Proceed anyway
</button>
</div>

<p class="alert-text-lists">
If we're flagging a legitimate website, please <a id="new-issue-link" href="#">report a detection problem.</a>
If we're flagging a legitimate website, please
<a id="new-issue-link" href="#">report a detection problem.</a>
</p>

<div class="spacer"></div>
<div class="twitter-share-container">
<img src="./x-logo-white.png" alt="X Icon" class="twitter-icon">
<img src="./x-logo-white.png" alt="X Icon" class="twitter-icon" />
<a
class="twitter-share"
href="https://twitter.com/intent/tweet?text=MetaMask%20just%20protected%20me%20from%20a%20phishing%20attack!%20Remember%20to%20always%20stay%20vigilant%20when%20clicking%20on%20links.%20Learn%20more%20at&url=https://metamask.io"
target="_blank"
rel="noopener noreferrer"
>
<p class="alert-text-lists">
If you found this helpful, click here to share on X!
</p>
<p class="alert-text-lists">
If you found this helpful, click here to share on X!
</p>
</a>
</div>

<div class="spacer-larger"></div>

<img src="./metamask-phishing-white.png" alt="MetaMask Phishing Warning Image" class="warning-image">
<img
src="./metamask-phishing-white.png"
alt="MetaMask Phishing Warning Image"
class="warning-image"
/>
</div>
<div id="content__framed-body" class="content__framed-body">
<p>
MetaMask flagged the site you're trying to visit as potentially deceptive. Attackers may trick you into doing something dangerous.
MetaMask flagged the site you're trying to visit as potentially
deceptive. Attackers may trick you into doing something dangerous.
</p>
<p>
<a id="open-self-in-new-tab" target="_blank">Open this warning in a new tab</a> for more information
on why this domain is blocked, and how to continue at your own risk.
<a id="open-self-in-new-tab" target="_blank"
>Open this warning in a new tab</a
>
for more information on why this domain is blocked, and how to
continue at your own risk.
</p>
</div>
</div>
Expand Down
Loading
Loading