From 9e98ebe750825c9a610aeebd3fd0cbee252d5359 Mon Sep 17 00:00:00 2001 From: Francis Rodriguez <39339295+Freshenext@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:09:46 -0400 Subject: [PATCH] Dao 717 Implemented gradient (#246) * DAO-710 feat: added HeaderTitle.tsx which is the typography that will be used for section titles. BREAKING CHANGE: changed background color and foreground color fix: removed plus icon from create proposal button. fix: will now use HeaderTitle in the HeaderSection for proposals page fix: will use HeaderTitle in the proposals page where latest proposals is fix: edited columns name fix: edited date output format feat: edited MetricsCard.tsx to account for new style changes. fix: My voting power in proposals is not a metric card anymore; this component was created there. fix: adjusted width of metrics card of proposals created to 272 pixels fix: camel case my voting power fix: proposal name column will not wrap, and the text will be white due to new changes in the table design. BREAKING CHANGE: table header will now contain new style changes. BREAKING CHANGE: the table will have no rounded borders anymore due to design change. BREAKING CHANGE: table head color has changed to the foreground per new design changes fix: exported Typography type so it can be used. * fix: will now use variant light for span * DAO-715 fix: metrics card will now use span instead of paragraph to better reflect its purpose for the fiatAmount. fix: the contractAddress link will have a margin top fix: MetricsSection.tsx will now use HeaderTitle fix: TotalTokenHoldingsSection.tsx will now use HeaderTitle fix: TreasurySection.tsx will use HeaderTitle. The metrics card will be borderless to reflect new design changes. * DAO-717 feat: added new button variant (sidebar-active) feat: added new component DivWithGradient.tsx feat: added gradient classes in the globals.css feat: added GradientHeader.tsx fix: removed classes from Header as design changes required it. fix: the sidebar will now have the ConnectedComponent prop which will be used to render that component. feat: added gradient header to sidebar feat: added gradient border to sidebar buttons fix: useful links added padding left feat: created SidebarButton component to implement DRY. --- src/app/globals.css | 21 +++++ src/app/treasury/MetricsSection.tsx | 4 +- .../treasury/TotalTokenHoldingsSection.tsx | 4 +- src/app/treasury/TreasurySection.tsx | 8 +- src/components/Button/Button.tsx | 2 + src/components/Button/DivWithGradient.tsx | 3 + src/components/Button/types.ts | 9 +- .../GradientHeader/GradientHeader.tsx | 7 ++ src/components/Header/Header.tsx | 2 +- src/components/LeftSidebar/LeftSidebar.tsx | 15 ++-- src/components/LeftSidebar/SidebarButtons.tsx | 83 +++++++++---------- src/components/LeftSidebar/UsefulLinks.tsx | 2 +- src/components/LeftSidebar/types.ts | 3 + .../MainContainer/MainContainer.tsx | 59 +++++++------ .../MainContainer/StatefulSidebar.tsx | 14 +++- src/components/MetricsCard/MetricsCard.tsx | 10 +-- 16 files changed, 148 insertions(+), 98 deletions(-) create mode 100644 src/components/Button/DivWithGradient.tsx create mode 100644 src/components/GradientHeader/GradientHeader.tsx diff --git a/src/app/globals.css b/src/app/globals.css index 7bf3cd58..673ed112 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -8,6 +8,27 @@ .underline-thick { text-decoration-thickness: 0.5px; } + + div.div-with-gradient::after { + background: linear-gradient(270deg, #FFFEE3 -30.96%, #F9E1FF 43.65%, #BE5B0F 77.22%, #932309 110.79%, #010101 155.56%); + content: ""; + width: 100%; + height: 1px; + display: block; + position: absolute; + top: 0; + left: 0; + } + + .gradient-header { + background: linear-gradient(270deg, #FFFEE3 -30.96%, #F9E1FF 43.65%, #BE5B0F 77.22%, #932309 110.79%, #010101 155.56%); + width: 100%; + height: 48px; + display: flex; + align-items: center; + padding-left: 25px; + } + } * { diff --git a/src/app/treasury/MetricsSection.tsx b/src/app/treasury/MetricsSection.tsx index d277cafc..023bbae3 100644 --- a/src/app/treasury/MetricsSection.tsx +++ b/src/app/treasury/MetricsSection.tsx @@ -1,4 +1,4 @@ -import { Paragraph } from '@/components/Typography' +import { HeaderTitle } from '@/components/Typography' import { Table } from '@/components/Table' import { TokenHoldingsStRIF } from '@/app/treasury/TokenHoldingsStRIF' @@ -12,7 +12,7 @@ const tableData = [ ] export const MetricsSection = () => (
- Metrics + Metrics ) diff --git a/src/app/treasury/TotalTokenHoldingsSection.tsx b/src/app/treasury/TotalTokenHoldingsSection.tsx index 70069331..663ef3ab 100644 --- a/src/app/treasury/TotalTokenHoldingsSection.tsx +++ b/src/app/treasury/TotalTokenHoldingsSection.tsx @@ -1,4 +1,4 @@ -import { Paragraph } from '@/components/Typography' +import { HeaderTitle } from '@/components/Typography' import { Table } from '@/components/Table' import { RenderTokenPrice } from '@/app/user/Balances/RenderTokenPrice' import { TokenHoldings } from '@/app/treasury/TokenHoldings' @@ -20,7 +20,7 @@ const tableData = [ export const TotalTokenHoldingsSection = () => (
- Total token holdings + Total token holdings
) diff --git a/src/app/treasury/TreasurySection.tsx b/src/app/treasury/TreasurySection.tsx index e5d0a13a..f3655efd 100644 --- a/src/app/treasury/TreasurySection.tsx +++ b/src/app/treasury/TreasurySection.tsx @@ -1,5 +1,5 @@ import { useTreasuryContext } from '@/app/treasury/TreasuryContext' -import { Paragraph } from '@/components/Typography' +import { HeaderTitle } from '@/components/Typography' import { MetricsCard } from '@/components/MetricsCard' import { toFixed } from '@/lib/utils' import { treasuryContracts } from '@/lib/contracts' @@ -8,17 +8,18 @@ export const TreasurySection = () => { const { buckets } = useTreasuryContext() return (
- Treasury + Treasury
{/* RIF Holdings */} {treasuryContracts.map((contract, index) => ( ))} {/* RBTC Holdings */} @@ -29,6 +30,7 @@ export const TreasurySection = () => { amount={toFixed(buckets[index].RBTC.amount)} fiatAmount={`= USD ${buckets[index].RBTC.fiatAmount}`} data-testid={`${contract.name}-RBTC`} + borderless /> ))}
diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index a2418b59..c72ba886 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -3,6 +3,7 @@ import { cn } from '@/lib/utils' import { FC, JSX, MouseEvent, ReactNode } from 'react' import { FaSpinner } from 'react-icons/fa6' import { Span } from '../Typography' +import { DivWithGradient } from '@/components/Button/DivWithGradient' export const BUTTON_DEFAULT_CLASSES = 'px-[24px] py-[12px] flex gap-x-1 items-center relative' @@ -78,6 +79,7 @@ export const Button: FC = ({ {startIcon} {text} + {variant === 'sidebar-active' && } ) } diff --git a/src/components/Button/DivWithGradient.tsx b/src/components/Button/DivWithGradient.tsx new file mode 100644 index 00000000..f2bcdd00 --- /dev/null +++ b/src/components/Button/DivWithGradient.tsx @@ -0,0 +1,3 @@ +export const DivWithGradient = () => ( +
+) diff --git a/src/components/Button/types.ts b/src/components/Button/types.ts index 8a86ce08..47f3603f 100644 --- a/src/components/Button/types.ts +++ b/src/components/Button/types.ts @@ -1 +1,8 @@ -export type ButtonVariants = 'primary' | 'secondary' | 'secondary-full' | 'borderless' | 'outlined' | 'white' +export type ButtonVariants = + | 'primary' + | 'secondary' + | 'secondary-full' + | 'borderless' + | 'outlined' + | 'white' + | 'sidebar-active' diff --git a/src/components/GradientHeader/GradientHeader.tsx b/src/components/GradientHeader/GradientHeader.tsx new file mode 100644 index 00000000..286ec3f9 --- /dev/null +++ b/src/components/GradientHeader/GradientHeader.tsx @@ -0,0 +1,7 @@ +import { Logo } from '@/components/Header/Logo' + +export const GradientHeader = () => ( +
+ +
+) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index a389a902..53405b2a 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -7,7 +7,7 @@ interface Props { export const Header = ({ children }: Props) => { return (
-
{children}
+
{children}
) } diff --git a/src/components/LeftSidebar/LeftSidebar.tsx b/src/components/LeftSidebar/LeftSidebar.tsx index 45296e25..63532227 100644 --- a/src/components/LeftSidebar/LeftSidebar.tsx +++ b/src/components/LeftSidebar/LeftSidebar.tsx @@ -1,19 +1,20 @@ -import { Logo } from '@/components/Header/Logo' import { SidebarButtons } from '@/components/LeftSidebar/SidebarButtons' import { UsefulLinks } from '@/components/LeftSidebar/UsefulLinks' import { LeftSidebarProps } from '@/components/LeftSidebar/types' -import { CopyrightInfo } from './CopyrightInfo' -export const LeftSidebar = ({ activeButton = 'communities', onSidebarButtonClick }: LeftSidebarProps) => { +export const LeftSidebar = ({ + activeButton = 'communities', + onSidebarButtonClick, + ConnectedComponent, +}: LeftSidebarProps) => { return ( -