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

added preview text for card, changed queries for same #35

Merged
merged 1 commit into from Oct 14, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/card.tsx
Expand Up @@ -14,12 +14,13 @@ type Props = {
description: string;
content: ContentType;
tags: string[];
preview: string;
selectedLang: string;
isLg: boolean;
isTab: boolean;
};

export default function Card({ name, content, description, tags, selectedLang, isLg, isTab }: Props) {
export default function Card({ name, content, description, preview, tags, selectedLang, isLg, isTab }: Props) {
const toast = useToast();

const handleCardClick = throttle(async () => {
Expand Down Expand Up @@ -87,7 +88,7 @@ export default function Card({ name, content, description, tags, selectedLang, i
fontWeight={600}
color={lightDarkVal("black", "white")}
>
{getContent()}
{preview}
</Text>
</Flex>

Expand Down
5 changes: 3 additions & 2 deletions src/graphql/queries.ts
Expand Up @@ -7,7 +7,7 @@ query {
description
tags
content
id
preview
}
}
`
Expand All @@ -18,7 +18,7 @@ query getPatternsLike($name: String){
name
description
tags
id
preview
content
}
}
Expand All @@ -31,6 +31,7 @@ query getPatterns($where: patterns_bool_exp) {
description
tags
content
preview
}
}
`
23 changes: 9 additions & 14 deletions src/pages/home.tsx
Expand Up @@ -2,38 +2,32 @@ import { SearchIcon } from "@chakra-ui/icons";
import { Input, InputGroup, InputLeftElement } from "@chakra-ui/input";
import {
Box,
Button,
Drawer,
Button, chakra, Drawer,
DrawerBody,
DrawerContent,
DrawerHeader,
DrawerOverlay,
Flex,
Grid,
Flex, FormControl,
FormHelperText,
FormLabel, Grid,
GridItem,
IconButton,
InputRightElement,
Text,
useDisclosure,
Text, useColorModeValue as lightDarkValue, useDisclosure,
useMediaQuery,
useToken,
useColorModeValue as lightDarkValue,
chakra,
FormControl,
FormHelperText,
FormLabel,
useToken
} from "@chakra-ui/react";

import { MultiValue, Select, SingleValue } from "chakra-react-select";
import { useNhostClient } from "@nhost/react";
import { MultiValue, Select, SingleValue } from "chakra-react-select";
import _, { debounce } from "lodash";
import React, { useCallback, useEffect, useRef, useState } from "react";
import Card from "../components/card";
import { PATTERNS, PATTERNS_AND_TAGS_Q, PATTERNS_LIKE } from "../graphql/queries";
import { tagsObject } from "../utils/tags";

import { SiJavascript, SiPython } from "react-icons/si";
import { IoIosFunnel } from "react-icons/io";
import { SiJavascript, SiPython } from "react-icons/si";

type Filter = {
search: string;
Expand All @@ -49,6 +43,7 @@ type Pattern = {
description: string;
content: ContentType;
tags: string[];
preview: string;
};

type OptionType = {
Expand Down