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

Feature: add footer, sidetag for feedback form #48

Merged
merged 4 commits into from
Oct 31, 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
1 change: 1 addition & 0 deletions web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ REACT_APP_SWAP_URL=https://flame.astria.org/swap
REACT_APP_POOL_URL=https://flame.astria.org/pool

REACT_APP_GA_TRACKING_ID=
REACT_APP_FEEDBACK_FORM_URL=
6 changes: 1 addition & 5 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@
"lint-apply-unsafe": "biome lint --apply-unsafe ./src ./public"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand Down
2 changes: 1 addition & 1 deletion web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" />

<style>
@font-face {
Expand Down
13 changes: 13 additions & 0 deletions web/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type React from "react";

export default function Footer(): React.ReactElement {
return (
<footer className="footer is-flex-align-items-flex-end mt-auto">
<div className="content has-text-centered">
<p>
Powered by <a href="https://www.astria.org/">Astria</a>
</p>
</div>
</footer>
);
}
30 changes: 30 additions & 0 deletions web/src/components/SideTag/SideTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type React from "react";

interface SideTagProps {
label: string;
url: string;
iconClass: string;
}

/**
* SideTag component to render a side tag with an icon and label.
* @param label
* @param url
* @param iconClass
*/
export default function SideTag({
label,
url,
iconClass,
}: SideTagProps): React.ReactElement {
return (
<div className="side-tag">
<a href={url} target="_blank" rel="noreferrer" className="side-tag-link">
<span className="icon is-small">
<i className={`fas ${iconClass}`} />
</span>
<span className="label">{label}</span>
</a>
</div>
);
}
8 changes: 8 additions & 0 deletions web/src/config/contexts/ConfigContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export const ConfigContextProvider: React.FC<ConfigContextProps> = ({
const swapURL = getEnvVariable("REACT_APP_SWAP_URL");
const poolURL = getEnvVariable("REACT_APP_POOL_URL");

let feedbackFormURL: string;
try {
feedbackFormURL = getEnvVariable("REACT_APP_FEEDBACK_FORM_URL");
} catch (e) {
feedbackFormURL = brandURL;
}

// retrieves the EVM chain with the given chain ID.
const getEvmChainById = (chainIdHex: string): EvmChainInfo => {
const chainIdNum = Number.parseInt(chainIdHex, 16);
Expand All @@ -46,6 +53,7 @@ export const ConfigContextProvider: React.FC<ConfigContextProps> = ({
bridgeURL,
swapURL,
poolURL,
feedbackFormURL,
getEvmChainById,
}}
>
Expand Down
1 change: 1 addition & 0 deletions web/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const ENV = {
REACT_APP_BRIDGE_URL: process.env.REACT_APP_BRIDGE_URL,
REACT_APP_SWAP_URL: process.env.REACT_APP_SWAP_URL,
REACT_APP_POOL_URL: process.env.REACT_APP_POOL_URL,
REACT_APP_FEEDBACK_FORM_URL: process.env.REACT_APP_FEEDBACK_FORM_URL,
};

/**
Expand Down
1 change: 1 addition & 0 deletions web/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type AppConfig = {
bridgeURL: string;
swapURL: string;
poolURL: string;
feedbackFormURL: string;
getEvmChainById(chainIdHex: string): EvmChainInfo;
};

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/BridgePage/BridgePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function BridgePage(): React.ReactElement {
return (
<section className="">
<div className="container px-2">
<div className="columns is-centered is-vcentered is-fullheight-with-navbar">
<div className="columns is-centered is-vcentered is-fullheight-with-navbar-and-footer">
<div className="column is-12-mobile is-8-tablet is-8-desktop is-6-widescreen">
<div className="card">
<div className="tabs is-fullwidth">
Expand Down
15 changes: 12 additions & 3 deletions web/src/pages/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import type React from "react";
import { Outlet } from "react-router-dom";
import { Outlet, ScrollRestoration } from "react-router-dom";

import Navbar from "components/Navbar/Navbar";
import Footer from "components/Footer/Footer";
import SideTag from "components/SideTag/SideTag";
import { useConfig } from "config";
import { Notification, useNotifications } from "features/Notifications";

/**
* Layout component with Navbar and footer.
* Uses `<Outlet />` to render children.
* Layout is also where notifications are rendered.
*/
export default function Layout(): React.ReactElement {
const { feedbackFormURL } = useConfig();
const { notifications, removeNotification } = useNotifications();

return (
<div>
<Navbar />

<Outlet />

<SideTag
iconClass="fa-up-right-from-square"
label="Get Help"
url={feedbackFormURL}
/>
<Footer />
{notifications.map((notification) => (
<Notification
key={notification.id}
Expand Down
9 changes: 9 additions & 0 deletions web/src/styles/footer-customizations.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import 'astria-colors';

.footer {
.content {
a {
color: $astria-orange-soft;
}
}
}
5 changes: 5 additions & 0 deletions web/src/styles/footer-overrides.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import 'astria-colors';

$footer-background-color: $astria-black;
$footer-color: $astria-white;
$footer-padding: 16px;
54 changes: 49 additions & 5 deletions web/src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
html, body {
height: 100vh;

}

// fonts
Expand All @@ -15,6 +14,7 @@ html, body {
@import 'button-overrides';
@import 'card-overrides';
@import 'dropdown-overrides';
@import 'footer-overrides';
@import 'form-overrides';
@import 'modal-overrides';

Expand All @@ -24,7 +24,7 @@ html, body {
@import '../../node_modules/bulma/sass/components/navbar';
@import '../../node_modules/@creativebulma/bulma-tooltip/dist/bulma-tooltip';
// NOTE - responsive-spacing-mixins weren't needed for v0, but i'm leaving them b/c
// i think they'll quickly be needed for v1
// i think they'll quickly be needed for v1
//@import 'responsive-spacing-mixins';
@import 'fixed-widths';

Expand All @@ -34,6 +34,7 @@ html, body {
@import 'card-customizations';
@import 'columns-customizations';
@import 'dropdown-customizations';
@import 'footer-customizations';
@import 'form-customizations';
@import 'modal-customizations';
@import 'navbar-customizations';
Expand All @@ -46,15 +47,58 @@ body {
background-color: $astria-black;
}

.is-fullheight-with-navbar {
// viewport height minus navbar height
min-height: calc(100vh - 85px)
.is-fullheight-with-navbar-and-footer {
// viewport height minus navbar and footer height
min-height: calc(100vh - 85px - 56px);
}

// custom styles for the side tag component
.side-tag {
position: absolute;
top: 50%;
right: 0;
background-color: $astria-orange-soft;
color: $astria-white;
font-size: 0.75rem;
font-weight: 700;
transform: translateX(40px) rotate(-90deg);
overflow: hidden;

@include mobile {
top: 75%;
}

.side-tag-link {
display: flex;
align-items: center;
padding: 0.5rem 0.75rem;
color: $astria-white;
transition: background-color 0.2s ease;

&:hover {
background-color: rgba(0, 0, 0, 0.1);
color: $astria-white;
}
}

.icon {
margin-right: 0.5rem;

i {
font-size: 1rem;
}
}

.label {
white-space: nowrap;
}
}

.notifications-toast-container {
position: fixed;
z-index: 9999;
padding: 1rem;

&.mid {
top: 50%;
left: 50%;
Expand Down