Skip to content

Commit

Permalink
Merge branch 'develop' into sero/clean-up-mega-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign committed Jun 29, 2023
2 parents 1f685ee + 71c3fa3 commit da0c54e
Show file tree
Hide file tree
Showing 24 changed files with 838 additions and 199 deletions.
24 changes: 24 additions & 0 deletions packages/design-system/src/theme/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export type MetaColors = ChakraTheme['colors'] & {
landing600: string;
landing650: string;
landingDarkGlass: string;
midnightBlue: string;
royalBlue: string;
deepMagenta: string;
darkMagenta: string;
plum: string;
wine: string;
};

export const colors: MetaColors = {
Expand Down Expand Up @@ -72,6 +78,12 @@ export const colors: MetaColors = {
cyanText: '#79F8FB',
discord: '#7289da',
discordDark: '#5d6eb3',
midnightBlue: '#141838',
royalBlue: '#214781',
deepMagenta: '#2B1441',
darkMagenta: '#2F1646',
plum: '#3E1C5D',
wine: '#410834',
cyan: {
50: '#dbffff',
100: '#b1fcfe',
Expand Down Expand Up @@ -144,6 +156,18 @@ export const colors: MetaColors = {
800: '#0d1a40',
900: '#02091b',
},
gray: {
50: '#F7FAFC',
100: '#EDF2F7',
200: '#E2E8F0',
300: '#CBD5E0',
400: '#A0AEC0',
500: '#718096',
600: '#4A5568',
700: '#2D3748',
800: '#1A202C',
900: '#171923',
},
landing50: '#1A0340',
landing100: '#240E74',
landing150: '#462080',
Expand Down
82 changes: 74 additions & 8 deletions packages/design-system/src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,87 @@ export const theme = extendTheme(
},
Button: {
variants: {
secondary: {
bg: 'black',
borderColor: 'darkMagenta',
borderRadius: 4,
borderWidth: 1,
boxShadow: 'xs',
color: 'white',
fontWeight: 600,
_hover: {
bg: 'deepMagenta',
borderColor: 'plum',
color: 'white',
},
_active: {
bg: 'plum',
borderColor: 'darkMagenta',
color: 'white',
},
_disabled: {
opacity: 0.4,
color: 'white',
},
},
outline: {
borderColor: 'blue.300',
color: 'blue.300',
borderColor: 'blueLight',
borderRadius: 4,
borderWidth: 1,
color: 'blueLight',
fontWeight: 600,
_hover: {
bg: 'midnightBlue',
borderColor: 'blueLight',
color: 'blueLight',
},
_active: {
bg: 'royalBlue',
borderColor: 'blueLight',
color: 'white',
},
_disabled: {
opacity: 0.5,
color: 'whiteAlpha.700',
},
},
ghost: {
bg: 'none',
borderRadius: 4,
border: 'none',
color: 'landing450',
fontWeight: 600,
_hover: {
bg: 'none',
textDecoration: 'underline',
},
_active: {
bg: 'darkMagenta',
textDecoration: 'underline',
},
_disabled: {
opacity: 0.5,
},
},
warning: {
borderColor: 'red.500',
borderRadius: 4,
borderWidth: 1,
color: 'red.500',
fontWeight: 600,
_hover: {
bg: 'rgba(0, 0, 0, 0.24)',
borderColor: 'blue.200',
color: 'blue.200',
bg: 'wine',
borderColor: 'red.500',
color: 'red.500',
},
_active: {
bg: 'rgba(0, 0, 0, 0.48)',
borderColor: 'blue.800',
color: 'blue.800',
bg: 'red.800',
borderColor: 'red.500',
color: 'red.50',
},
_disabled: {
opacity: 0.5,
color: 'red.500',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/Guild/Join/Requirements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const Requirements: React.FC = () => (
bg="#E839B7"
borderRadius={0}
color="white"
href="https://wiki.metagame.wtf/docs/enter-metagame/join-metagame"
href="/play/paths/engaged-octos-path"
minW="10rem"
mt={2}
px={6}
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/Guild/Join/TiersPerks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import React from 'react';
const CommonTierNFTLink =
'https://rarible.com/token/0xc8137071edb6fa4ad31addd3d8a33a764d6632a1:59326192270149874852904822880970320523432047447669756248509216615709326442507?tab=overview';
const EpicTierNFTLink =
'https://rarible.com/token/0xc8137071edb6fa4ad31addd3d8a33a764d6632a1:59326192270149874852904822880970320523432047447669756248509216615709326442501?tab=overview';
const RareTierNFTLink =
'https://rarible.com/token/0xc8137071edb6fa4ad31addd3d8a33a764d6632a1:59326192270149874852904822880970320523432047447669756248509216615709326442497?tab=overview';
const RareTierNFTLink =
'https://rarible.com/token/0xc8137071edb6fa4ad31addd3d8a33a764d6632a1:59326192270149874852904822880970320523432047447669756248509216615709326442501?tab=overview';

export const TiersPerks: React.FC = () => (
<Container
Expand Down
55 changes: 55 additions & 0 deletions packages/web/components/Quest/QuestArticleCss.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Quest Article CSS
* The typography for the quest description is different to the standard withProse/Markdown
* ref: https://www.figma.com/file/2yEeQUrgPOrLOq6DpC6Mb7/Quests-UI?node-id=519-2199&t=f7ABDY7Dw2Yxtrsc-0
*
* Main things
* - Block elements have bottom margins but no top margin / The margins are tighter
* - The font sizes are larger
*/

export const questArticleCss = {
'.mg-article-typography': {
// Basic coverage
fontSize: 'var(--chakra-fontSizes-xl)',
lineHeight: '1.4',

// Margins/font-size for main block elements that might be in the article
'address, aside, blockquote, details, dl, figure, form, ol, p, pre, section, table, ul':
{
fontSize: 'var(--chakra-fontSizes-xl)',
lineHeight: '1.4',
marginBottom: 'var(--chakra-space-8)',
marginTop: '0',
},

summary: {
fontSize: 'var(--chakra-fontSizes-2xl)',
cursor: 'pointer',
},

// Specific to headings
// Includes HHH-GH being opinionated with the marginTop
'h1, h2, h3, h4, h5, h6': {
marginTop: 'var(--chakra-space-12)', // extra space between heading and preceding content ...
marginBottom: 'var(--chakra-space-8)',
},
'h1:first-of-type, h2:first-of-type, h3:first-of-type, h4:first-of-type, h5:first-of-type, h6:first-of-type':
{
marginTop: '0', // ... unless it's the first one
},

':is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6)': {
marginTop: '0', // ... or if two headings are adjacent
},
'h1, h2': {
fontSize: 'var(--chakra-fontSizes-4xl)',
},
h3: {
fontSize: 'var(--chakra-fontSizes-3xl)',
},
'h4, h5, h6': {
fontSize: 'var(--chakra-fontSizes-xl)',
},
},
};
6 changes: 4 additions & 2 deletions packages/web/components/Quest/QuestCompletions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ export const QuestCompletions: React.FC<Props> = ({ quest }) => {

return (
<Box>
<VStack spacing={4}>
<VStack spacing={4} align="left">
{quest.quest_completions.length === 0 && (
<Text>There are no proposal for this quest yet.</Text>
<Text>
There has not yet been a proposal submitted for this quest.
</Text>
)}
{quest.quest_completions.map(
({
Expand Down
27 changes: 27 additions & 0 deletions packages/web/components/Quest/QuestDetailsDescription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Box, Heading, Link, Prose, Text } from '@metafam/ds';
import { isSGML } from '@metafam/utils';
import { MarkdownViewer as Markdown } from 'components/MarkdownViewer';
import { QuestFragment } from 'graphql/autogen/types';
import React from 'react';
import { safelyParseNChakrifyHtml } from 'utils/stringHelpers';

type Props = {
quest: QuestFragment;
};

export const QuestDetailsDescription: React.FC<Props> = ({ quest }) => {
const descIsHtml = isSGML(quest.description ?? '');
const parsedDescription = descIsHtml
? safelyParseNChakrifyHtml(quest.description ?? '')
: null;

return (
<Box className="mg-article-typography">
{descIsHtml ? (
<Prose>{parsedDescription}</Prose>
) : (
<Markdown>{quest.description}</Markdown>
)}
</Box>
);
};
110 changes: 110 additions & 0 deletions packages/web/components/Quest/QuestDetailsHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import {
Box,
Button,
Flex,
Heading,
MetaButton,
Stack,
Text,
VStack,
} from '@metafam/ds';
import { MetaLink } from 'components/Link';
import { PlayerAvatar } from 'components/Player/PlayerAvatar';
import { Quest, QuestFragment, QuestStatus_Enum } from 'graphql/autogen/types';
import { useUser } from 'lib/hooks';
import { usePlayerName } from 'lib/hooks/player/usePlayerName';
import { usePlayerURL } from 'lib/hooks/player/usePlayerURL';
import React from 'react';

import { RepetitionTag, StatusTag } from './QuestTags';

type Props = {
quest: QuestFragment;
};

export const QuestDetailsHeader: React.FC<Props> = ({ quest }) => {
const playerName = usePlayerName(quest.player);
const playerProfileLinkURL = usePlayerURL(quest.player);
const { user } = useUser();
const isMyQuest = user?.id === (quest as Quest).player.id;
const {
repetition,
cooldown,
// createdAt,
// externalLink: link,
title,
status,
} = quest;

return (
<Flex
as="header"
alignItems="center"
flexDirection={{
base: 'column',
md: 'row',
}}
gap={6}
mb={[8, 8, 12]}
>
<Box w="full" flexBasis="100%">
<Heading
as="h1"
fontFamily="body"
fontWeight="600"
fontSize={{ base: '5xl', md: '8xl' }}
mb={5}
>
{title}
</Heading>

<Flex
gap={2}
fontSize="2xl"
lineHeight="1.1"
alignItems="flex-start"
mb={5}
>
<Text as="div" fontWeight="400" whiteSpace="nowrap">
Created by
</Text>

<Flex alignItems="flex-start" gap={2}>
<PlayerAvatar player={quest.player} size="sm" />

<Text
wordBreak="break-all" /* in case of really long usernames or an ETH address as username */
>
<MetaLink href={playerProfileLinkURL}>{playerName}</MetaLink>
</Text>
</Flex>
</Flex>

<Flex gap={2}>
<StatusTag status={status} />
<RepetitionTag {...{ repetition, cooldown }} />
</Flex>
</Box>

{/* Edit button is displayed to the Quest Owner */}
{isMyQuest && status === QuestStatus_Enum.Open && (
<Box w="full" maxW={{ base: '100%', md: '12rem' }}>
{/* Stacked vertically after md breakpoint */}
<Stack spacing={5} direction={{ base: 'row', md: 'column' }}>
<Button
as="a" // so it can be used as a link
href={`/quest/${quest.id}/edit`}
variant="outline"
borderWidth={2}
size="lg"
fontSize="md"
w="full"
>
Edit quest
</Button>
</Stack>
</Box>
)}
</Flex>
);
};
17 changes: 17 additions & 0 deletions packages/web/components/Quest/QuestDetailsImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { AspectRatio, Image } from '@metafam/ds';
import React from 'react';

type Props = {
src: string;
};

export const QuestDetailsImage: React.FC<Props> = ({ src }) => (
<AspectRatio
ratio={{
base: 1 / 1,
md: 4 / 3,
}}
>
<Image src={src} alt="" borderRadius={10} fit="cover" />
</AspectRatio>
);
Loading

0 comments on commit da0c54e

Please sign in to comment.