fix: adjust mdx components style

This commit is contained in:
Hossein Mehrabi
2023-06-01 19:40:11 +03:30
parent 3a8747ee88
commit 478aa9618b
19 changed files with 358 additions and 50 deletions
@@ -28,7 +28,7 @@ const config = {
'@acid-info/logos-docusaurus-preset',
/** @type {import('@acid-info/logos-docusaurus-preset').PluginOptions} */
({
businessUnit: 'Nimbus',
businessUnit: 'Waku',
theme: {
name: 'default',
options: {
@@ -37,6 +37,7 @@ const config = {
},
docs: {
routeBasePath: '/docs',
breadcrumbs: false,
versions: {
current: {
label: 'current',
@@ -9,6 +9,7 @@ import {
Showcase,
HeroModel,
HeroInfo,
Box,
} from '../components/mdx'
<Hero size="large">
@@ -70,39 +71,71 @@ import {
]}
/>
<CallToActionSection
title="User adoptions"
description="Waku has brought private, censorship-resistant communications to several notable web3 DApps, decentralizing their messaging components:"
label="Decentralize your DApp"
href="/join"
/>
<Box top={{ xs: 144, lg: 216 }}>
<CallToActionSection
title="Team"
columns={1}
description="Waku is built and maintained by a global team of experienced and driven software developers and researchers that share a passion for privacy and decentralized technologies. "
label="Read more"
href="/about/team"
/>
</Box>
<Showcase
id="showcase"
items={[
{
name: 'XMTP',
logo: '/showcase/xmtp-mark-white.svg',
description:
"Inter-blockchain account messaging protocol XMTP uses Waku's Go implementation to facilitate communication between nodes in its currently permissioned network.",
},
{
name: 'Status',
logo: '/showcase/status-mark-white.svg',
description:
"Waku powers many of the Status super app's features, including its private messaging.",
},
{
name: 'Railgun',
logo: '/showcase/railgun-mark-white.svg',
description:
'The privacy-focused DeFi protocol Railgun anonymizes Ethereum transactions with Waku. ',
},
]}
/>
<Box top={{ xs: 144, lg: 216 }}>
<CallToActionSection
title="Used by"
columns={2}
description="Waku has brought private, censorship-resistant communications to several notable web3 DApps, decentralizing their messaging components:"
label="Decentrialize your DApp"
href="https://docs.waku.org"
/>
</Box>
<CallToActionSection
title="Join the community to discover what Waku can bring to your DApp"
label="Decentralize your DApp"
href="/join"
/>
<Box top={{ xs: 64, lg: 100 }}>
<Showcase
id="showcase"
items={[
{
name: 'XMTP',
logo: '/showcase/xmtp-mark-white.svg',
description:
"Inter-blockchain account messaging protocol XMTP uses Waku's Go implementation to facilitate communication between nodes in its currently permissioned network.",
},
{
name: 'TheGraph',
logo: '/showcase/the-graph-mark-white.svg',
description:
'Waku powers the Graphcast SDK, enabling the development of gossip-powered applications within The Graph ecosystem.',
},
{
name: 'Status',
logo: '/showcase/status-mark-white.svg',
description:
"Waku powers many of the Status super app's features, including its private messaging.",
},
{
name: 'Railgun',
logo: '/showcase/railgun-mark-white.svg',
description:
'The privacy-focused DeFi protocol Railgun anonymizes Ethereum transactions with Waku. ',
},
]}
/>
</Box>
<Box top={{ xs: 144, lg: 216 }}>
<CallToActionSection
title="Development roadmap"
description="Waku has the ambitious goal of attracting and supporting millions of simultaneous users, truly serving as the communications standard across web3. Our development roadmap focuses on achieving secure scalability before implementing incentivization mechanisms to sustain Waku."
label="Read more"
href="/about/development-roadmap"
/>
</Box>
<Box top={{ xs: 144, lg: 336 }} bottom={{ lg: 16, xs: 64 }}>
<CallToActionSection
title="Join the community to discover what Waku can bring to your DApp"
label="Decentralize your DApp"
href="/join"
/>
</Box>
@@ -0,0 +1,3 @@
<svg width="58" height="58" viewBox="0 0 58 58" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M26.6666 33.111C19.7939 33.111 14.2222 27.5397 14.2222 20.6666C14.2222 13.7935 19.7939 8.2222 26.6666 8.2222C33.5397 8.2222 39.111 13.7935 39.111 20.6666C39.111 27.5397 33.5397 33.111 26.6666 33.111ZM26.6666 2C36.9759 2 45.3332 10.3574 45.3332 20.6666C45.3332 30.9758 36.9759 39.3332 26.6666 39.3332C16.3574 39.3332 8 30.9758 8 20.6666C8 10.3574 16.3574 2 26.6666 2ZM44.4221 40.2443C45.6371 41.4593 45.6371 43.4289 44.4221 44.644L31.9773 57.0887C30.7623 58.3038 28.7927 58.3038 27.5777 57.0887C26.3627 55.8737 26.3627 53.9041 27.5777 52.6891L40.0225 40.2443C41.2375 39.0293 43.2071 39.0293 44.4221 40.2443ZM51.5554 5.1111C51.5554 6.82956 50.1628 8.2222 48.4447 8.2222C46.7262 8.2222 45.3336 6.82956 45.3336 5.1111C45.3336 3.39264 46.7262 2 48.4447 2C50.1628 2 51.5554 3.39264 51.5554 5.1111Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 960 B

@@ -0,0 +1,32 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-box {
padding-top: var(--mdx-box-top);
padding-bottom: var(--mdx-box-bottom);
@include utils.responsive('xs', 'up') {
--mdx-box-top: var(--mdx-box-top-xs);
--mdx-box-bottom: var(--mdx-box-bottom-xs);
}
@include utils.responsive('sm', 'up') {
--mdx-box-top: var(--mdx-box-top-sm);
--mdx-box-bottom: var(--mdx-box-bottom-sm);
}
@include utils.responsive('md', 'up') {
--mdx-box-top: var(--mdx-box-top-md);
--mdx-box-bottom: var(--mdx-box-bottom-md);
}
@include utils.responsive('lg', 'up') {
--mdx-box-top: var(--mdx-box-top-lg);
--mdx-box-bottom: var(--mdx-box-bottom-lg);
}
@include utils.responsive('xl', 'up') {
--mdx-box-top: var(--mdx-box-top-xl);
--mdx-box-bottom: var(--mdx-box-bottom-xl);
}
}
@@ -0,0 +1,68 @@
import clsx from 'clsx'
import React from 'react'
import { makeStyle } from '../../../lib/makeStyle'
import './Box.scss'
type BreakpointsStyle<T> = {
xs?: T
sm?: T
md?: T
lg?: T
xl?: T
}
function vars(
key: string,
_val: BreakpointsStyle<string | number> | string | number,
defaultValue: string | number,
unit?: string,
) {
const val =
typeof _val === 'string' || typeof _val === 'number' ? { xs: _val } : _val
const variables: string[][] = []
const format = (value: any) => {
return typeof value === 'number' && unit ? `${value}${unit}` : `${value}`
}
;['xs', 'sm', 'md', 'lg', 'xl'].forEach((bp, index) => {
const value = val[bp]
if (!value) {
const prev = variables[index - 1]?.[1]
variables.push([`${key}-${bp}`, prev ? prev : format(defaultValue)])
} else variables.push([`${key}-${bp}`, format(value)])
})
return Object.fromEntries(variables)
}
export type BoxProps = React.HTMLAttributes<HTMLDivElement> & {
top?: BreakpointsStyle<number> | number
bottom?: BreakpointsStyle<number> | number
}
export const Box: React.FC<BoxProps> = ({
top = 0,
bottom = 0,
className,
style = {},
children,
...props
}) => {
return (
<div
className={clsx(className, 'mdx-box')}
style={makeStyle(
{ ...style },
{
...vars('mdx-box-top', top, 0, 'px'),
...vars('mdx-box-bottom', bottom, 0, 'px'),
},
)}
{...props}
>
{children}
</div>
)
}
@@ -0,0 +1 @@
export * from './Box'
@@ -1,8 +1,8 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-cta-section {
display: grid;
margin-top: 216px;
border-top: 1px solid rgb(var(--lsd-border-primary));
}
@@ -57,3 +57,36 @@
}
}
}
@include utils.responsive('lg', 'down') {
.mdx-cta-section {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.mdx-cta-section__title {
@include lsd.typography('subtitle1');
margin-top: 1rem;
}
.mdx-cta-section__description {
@include lsd.typography('h5');
margin-top: 1.5rem !important;
}
.mdx-cta-section__link {
@include lsd.typography('label2');
margin-top: 2rem;
button {
padding: 6px 12px;
}
}
.mdx-cta-section:not(.mdx-cta-section--with-description) {
.mdx-cta-section__title {
@include lsd.typography('h5');
}
}
}
@@ -28,8 +28,6 @@ export const CallToActionSection: React.FC<CallToActionSectionProps> = ({
return (
<div
variant="h1"
component="h1"
className={clsx(
className,
'mdx-cta-section',
@@ -40,7 +38,7 @@ export const CallToActionSection: React.FC<CallToActionSectionProps> = ({
>
<Typography
variant={singleCol && !description ? 'h1' : 'h6'}
component="span"
component="h2"
className="mdx-cta-section__title"
>
{title}
@@ -48,7 +46,7 @@ export const CallToActionSection: React.FC<CallToActionSectionProps> = ({
{description && (
<Typography
variant={singleCol ? 'h2' : 'h4'}
component="span"
component="h3"
className="mdx-cta-section__description"
>
{description}
@@ -1,3 +1,6 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-feature-list {
border-top: 1px solid rgb(var(--lsd-surface-secondary));
position: relative;
@@ -44,3 +47,48 @@
.mdx-feature-list__feature-description {
margin-top: 8.625rem;
}
@include utils.responsive('lg', 'down') {
.mdx-feature-list {
}
.mdx-feature-list__title {
@include lsd.typography('subtitle1');
padding: 1rem 0;
}
.mdx-feature-list__list {
grid-template-columns: 1fr;
}
.mdx-feature-list__feature {
border: none;
padding: 1.5rem 0;
border-top: 1px solid rgb(var(--lsd-border-primary));
.mdx-feature-list__feature-index {
@include lsd.typography('subtitle2');
width: 1.625rem;
height: 1.625rem;
}
.mdx-feature-list__feature-title {
@include lsd.typography('h5');
margin-top: 1rem;
}
.mdx-feature-list__feature-description {
@include lsd.typography('subtitle1');
margin-top: 3rem;
}
.mdx-feature-list__feature-inner {
}
&:nth-child(odd) {
.mdx-feature-list__feature-inner {
border: none;
}
}
}
}
@@ -27,7 +27,7 @@ export const FeatureList: React.FC<FeatureListProps> = ({
<div className={clsx(className, 'mdx-feature-list')} {...props}>
<Typography
variant="h6"
component="div"
component="h1"
className="mdx-feature-list__title"
>
{title}
@@ -45,14 +45,14 @@ export const FeatureList: React.FC<FeatureListProps> = ({
</Typography>
<Typography
variant="h3"
component="div"
component="h2"
className="mdx-feature-list__feature-title"
>
{feature.title}
</Typography>
<Typography
variant="h6"
component="div"
component="h3"
className="mdx-feature-list__feature-description"
>
{feature.description}
@@ -1,6 +1,5 @@
.mdx-hero {
position: relative;
border-top: 1px solid rgb(var(--lsd-surface-secondary));
}
.mdx-hero--large {
@@ -1,4 +1,4 @@
@use '../../../css/lsd';
@use '../../../css/utils';
.mdx-hero-action {
}
@@ -8,3 +8,11 @@
padding: 10px 64px;
}
}
@include utils.responsive('lg', 'down') {
.mdx-hero-action {
button {
padding: 6px 12px !important;
}
}
}
@@ -1,3 +1,5 @@
@use '../../../css/utils';
.mdx-hero-actions {
margin-top: 2rem;
display: flex;
@@ -8,3 +10,20 @@
position: relative;
z-index: 98;
}
@include utils.responsive('lg', 'down') {
.mdx-hero-actions {
width: 100%;
margin-top: 1.5rem;
display: flex;
flex-direction: row;
align-items: center;
justify-content: stretch;
> a,
> a > button {
display: block;
width: 100%;
}
}
}
@@ -1,3 +1,6 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-hero-description {
z-index: -2;
}
@@ -7,6 +10,16 @@
}
.mdx-hero-description--large {
font-size: 5.0625rem !important;
line-height: 5.5rem !important;
// font-size: 5.0625rem !important;
// line-height: 5.5rem !important;
}
@include utils.responsive('lg', 'down') {
.mdx-hero-description {
@include lsd.typography('h3');
}
.mdx-hero-description--large {
font-size: 1.875rem !important;
}
}
@@ -1,3 +1,6 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-hero-title {
font-weight: 300 !important;
z-index: -2;
@@ -11,3 +14,13 @@
.mdx-hero-title--uppercase {
text-transform: uppercase;
}
@include utils.responsive('lg', 'down') {
.mdx-hero-title {
@include lsd.typography('h3');
}
.mdx-hero-title--large {
font-size: 1.875rem !important;
}
}
@@ -1,6 +1,11 @@
@use '../../../css/utils';
@use '../../../css/lsd';
.mdx-showcase {
width: 100%;
overflow: hidden;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(4, 1fr);
gap: 1rem;
}
@@ -24,3 +29,23 @@
margin-top: 24px;
padding-top: 16px;
}
@include utils.responsive('lg', 'down') {
.mdx-showcase {
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem 1rem;
}
.mdx-showcase__item-name {
@include lsd.typography('h6');
}
.mdx-showcase__item-description {
margin-top: 1rem;
}
.mdx-showcase__item-logo {
width: 34px;
height: auto;
}
}
@@ -34,7 +34,7 @@ export const Showcase: React.FC<ShowcaseProps> = ({
/>
<Typography
variant="h3"
component="div"
component="h2"
className="mdx-showcase__item-name"
>
{item.name}
@@ -1,10 +1,11 @@
export * from './Box'
export * from './CallToActionSection'
export * from './FeatureList'
export * from './Hero'
export * from './HeroAction'
export * from './HeroActions'
export * from './HeroDescription'
export * from './HeroInfo'
export * from './HeroModel'
export * from './HeroTitle'
export * from './Showcase'
export * from './HeroInfo'
@@ -0,0 +1,13 @@
import React from 'react'
export const makeStyle = (
style: React.CSSProperties,
vars: Record<string, any> = {},
) =>
({
...style,
...Object.entries(vars).reduce(
(value, [name, val]) => ({ ...value, [`--${name}`]: val }),
{},
),
} as React.CSSProperties)