Fix download button & improvements

This commit is contained in:
pheralb 2022-03-04 13:34:58 +00:00
parent ac2a81563b
commit b67dcc0be9
9 changed files with 80 additions and 59 deletions

View File

@ -1,8 +1,16 @@
<p align="center">
<a href="https://svgl.vercel.app/">
<img src="https://raw.githubusercontent.com/pheralb/svgl/main/public/images/logo.png" width="100px" alt="svgl logo" />
</a>
</p>
## 🚀 Getting started: ## 🚀 Getting started:
[SVGL](https://svgl.vercel.app/) is a beautiful collection of SVG logos. Free and open source.
You need: You need:
- [Node.js 16+ (recommend: 16.13.2 LTS)](https://nodejs.org/en/) - [Node.js 16+ (recommend: 16.14.0 LTS)](https://nodejs.org/en/)
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
and run: and run:
@ -14,6 +22,6 @@ npm run dev
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## 📦 Deployed on Vercel: ## 🔑 License:
[https://svgl.vercel.app/](https://svgl.vercel.app/) MIT

View File

@ -1,12 +0,0 @@
import React from "react";
import { motion } from "framer-motion";
const Hover = ({ children }) => {
return (
<motion.div whileHover={{ scale: 1.020 }} whileTap={{ scale: 1 }}>
{children}
</motion.div>
);
};
export default Hover;

12
animations/tap.js Normal file
View File

@ -0,0 +1,12 @@
import React from "react";
import { motion } from "framer-motion";
const Tap = ({ children }) => {
return (
<motion.div whileTap={{ scale: 0.99 }}>
{children}
</motion.div>
);
};
export default Tap;

View File

@ -1,30 +1,32 @@
import React from "react"; import React from "react";
import Link from "next/link"; import Link from "next/link";
import { Box, Text, Icon, Image, Center } from "@chakra-ui/react"; import { Box, Text, Icon, Image, Center } from "@chakra-ui/react";
import Hover from "animations/hover"; import Tap from "animations/tap";
const Index = ({ title, url, href }) => { const Index = ({ title, url, href }) => {
return ( return (
<Link href={url} passHref> <Tap>
<Box <Link href={url} passHref>
_hover={{ <Box
shadow: "md", _hover={{
transform: "translateY(-4px)", shadow: "md",
transition: "all .3s", transform: "translateY(-4px)",
}} transition: "all .3s",
p={4} }}
cursor="pointer" p={4}
borderRadius="10px" cursor="pointer"
mb="3" borderRadius="10px"
> mb="3"
<Center> >
<Image src={href} alt={title} boxSize="60px" /> <Center>
</Center> <Image src={href} alt={title} boxSize="60px" />
<Text mt="2" fontWeight="light" textAlign={"center"}> </Center>
{title} <Text mt="2" fontWeight="light" textAlign={"center"}>
</Text> {title}
</Box> </Text>
</Link> </Box>
</Link>
</Tap>
); );
}; };

View File

@ -0,0 +1,9 @@
import React from 'react'
const Index = () => {
return (
<div>Index</div>
)
}
export default Index

View File

@ -20,7 +20,7 @@ import {
} from "react-icons/io5"; } from "react-icons/io5";
import { BiLinkExternal } from "react-icons/bi"; import { BiLinkExternal } from "react-icons/bi";
import Link from "next/link"; import Link from "next/link";
import Hover from "animations/hover"; import Hover from "animations/tap";
import Show from "animations/show"; import Show from "animations/show";
import { svgl } from "components/svg"; import { svgl } from "components/svg";
import HEADER_LINKS from "./links"; import HEADER_LINKS from "./links";

View File

@ -6,37 +6,40 @@ import {
Input, Input,
InputLeftElement, InputLeftElement,
InputGroup, InputGroup,
Button,
Flex, Flex,
HStack, HStack,
Text, Text,
Image, Image,
Icon, Icon,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { IoCloudDownloadOutline, IoLink, IoSearch } from "react-icons/io5"; import { IoSearch } from "react-icons/io5";
import { BiLinkExternal } from "react-icons/bi";
import { Algolia } from "components/svg"; import { Algolia } from "components/svg";
import Tap from "animations/tap";
const AutocompleteItem = ({ id, title, href, url }) => { const AutocompleteItem = ({ id, title, href, url }) => {
return ( return (
<> <>
<Link href={`/svg/${id}`} passHref> <Tap>
<Box <Link href={`/svg/${id}`} passHref>
id={id} <Box
w="100%" id={id}
borderWidth="1px" w="100%"
borderRadius="6px" borderWidth="1px"
mt="3" borderRadius="6px"
cursor="pointer" mt="3"
> cursor="pointer"
<HStack py={6} px={6} spacing={2}> >
<Image src={href} alt={title} boxSize="20px" mr="2" /> <HStack py={6} px={6} spacing={2}>
<Text fontSize="18px" fontWeight="light"> <Image src={href} alt={title} boxSize="20px" mr="2" />
{title} <Text fontSize="18px" fontWeight="light">
</Text> {title}
<Icon as={IoLink} /> </Text>
</HStack> <Icon as={BiLinkExternal} />
</Box> </HStack>
</Link> </Box>
</Link>
</Tap>
</> </>
); );
}; };

View File

@ -41,7 +41,7 @@ export default function Icon() {
const downloadSvg = (name, url) => { const downloadSvg = (name, url) => {
confetti(); confetti();
download(url, `${name}.svg`, "image/svg+xml"); download(url);
}; };
return ( return (
@ -100,7 +100,6 @@ export default function Icon() {
</Flex> </Flex>
</Flex> </Flex>
</SimpleGrid> </SimpleGrid>
<Link href="/" passHref> <Link href="/" passHref>
<Button <Button
leftIcon={<IoArrowBackOutline />} leftIcon={<IoArrowBackOutline />}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 174 KiB