Portfolio2.0
By abbeyperini
svgr
Transform SVGs into React components 🦁 (by gregberge)
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
Portfolio2.0 | svgr | |
---|---|---|
9 | 30 | |
27 | 10,324 | |
- | - | |
6.4 | 5.6 | |
14 days ago | 8 days ago | |
JavaScript | TypeScript | |
GNU General Public License v3.0 or later | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Portfolio2.0
Posts with mentions or reviews of Portfolio2.0.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2021-11-28.
-
Dark Mode Toggle and prefers-color-scheme
You can check out all the code for this app in my portfolio repo.
-
What are Favicons?
To update my favicon, I need to update two tags in my index.html file. Because of how React works, the two paths in my href="" attributes start with %PUBLIC_URL% before the /, but here's the code with a more universal path:
-
Accessibility Auditing My Portfolio Site - Part 6
, because I want it to be visually hidden, I'll be fixing that when I get to this Github issue. WAVE mostly returned errors I had already vetted. It did actually catch one of the many broken links that I'll be fixing in this Github issue. It returned 27 long alt-text warnings on my blog page, but they're all less than 150 characters. I also got false positive contrast errors for my visually hidden skip links. ARC is down to primarily false positives. There were a couple I had to look up to make sure they were ok, like buttons with transparent backgrounds and using images with alt-text or an aria-label instead of text in links. The IBM Equal Access Accessibility checker just stopped working. It refused to scan even after I restarted Chrome, uninstalled and reinstalled it in Chrome, and installed it in Firefox. I saw something about the ruleset being undefined, so hopefully they fix that soon. Luckily, I ran it multiple times in Part 5 so I'm comfortable with moving on. The Microsoft Accessibility Insights Fast Pass didn't find anything that wasn't already on my radar, but I will be using the Assessment option as a guide for my manual testing again.
-
Accessibility Auditing My Portfolio Site - Part 4
This blog will focus on making the blog preview component code on the main page of my site more accessible.
-
An Accessible Dark Mode Toggle in React
My portfolio Github repository has all the toggle component code and the toggle CSS. The structure of the toggle looks like this:
-
Accessibility Auditing My Portfolio Site - Part 2
If I wanted these to be the most accessible, I would also add another visual cue that showed "this link will open in a new tab" on hover or focus. This would be ideal for the links attached to the Github and Chrome SVGs and for keyboard and unassisted users that don't know what the external icon link means. However, I would want to spend time I don't have today designing a nice-looking version of that, so I've added this to my Github repository as my first backlog issue for this site.
- Adding Shiba Inu Loading and Error SVGs to My React Site
-
A Walkthrough of Updating My Portfolio Site with Netlify Functions and the Dev.to API
When I found out DEV has an API that will send you the HTML of each of your blogs, I made a branch in my portfolio site repo, rewrote my FullBlog component, and attempted to call the API from within the established Blog React component. No dice. CORS error. Now I knew that I needed a server so I could use a CORS package or another solution. At this point, I also noticed I'd have to call the DEV API /articles/me endpoint to get the ids of each of my blogs and then call the /articles/{id} endpoint with the id to get the HTML version or find a solution for the markdown version.
-
Toggle Dark Mode in React
Next, I added the toggle component to my navigation bar component. I styled the toggle following Chris Bongers’ Tutorial based on Katia De Juan’s Dribbble. Then I adjusted the size and flipped it to default to dark mode. While this toggle is so cute that you could die, this tutorial will work with any or clickable . First, I set up the basic JSX, the local state, and a variable to hold the theme we get from localStorage: import React, { useEffect, useState } from 'react'; import '../styles/toggle.css'; import { setTheme } from '../utils/themes'; function Toggle() { const [togClass, setTogClass] = useState('dark'); let theme = localStorage.getItem('theme'); return (
{ togClass === "light" ? : }) } Enter fullscreen mode Exit fullscreen mode Finally, my favorite part: the color switching SVGs! CSS variables work in SVG code too! I got my SVG code for the Github and Chrome icons from DEVICON. For the Github icon all I had to change was one fill attribute in a : fill="var(--dark-text)"> Enter fullscreen mode Exit fullscreen mode The Chrome icon had a fill attribute in a and a : fill="var(--dark-text)" cx="63.624" cy="64.474" r="22.634"> fill="var(--dark-text)" ...> Enter fullscreen mode Exit fullscreen mode The result looks like this: Conclusion I tried to include all of the relevant code, but you can also see the full code for my site in its Github repository. If you enjoyed this article or are left with questions, please leave a comment below! I would also love to see anything built following this tutorial.
svgr
Posts with mentions or reviews of svgr.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-06-27.
-
Nx + NextJS + Docker - The Nx way: Creating the NextJS application
//@ts-check // eslint-disable-next-line @typescript-eslint/no-var-requires const { composePlugins, withNx } = require('@nx/next'); /** * @type {import('@nx/next/plugins/with-nx').WithNxOptions} **/ const nextConfig = { nx: { // Set this to true if you would like to use SVGR // See: https://github.com/gregberge/svgr svgr: false, }, }; const plugins = [ // Add more Next.js plugins to this list if needed. withNx, ]; module.exports = composePlugins(...plugins)(nextConfig);
- Easily use SVGs as JSX/TSX in your ReactJs app
- How do I use SVG icons in React?
-
SVGR for your React app
Most of the time, developers tend to add svg images to an assets directory and import them either directly or as a React component. This process not only increases your app bundle size but also makes managing all the assets difficult. What if there was a way to manage all the application icons like the way we import them from any other icon library? Yes, react-svgr helps you manage all the icons in your React application.
-
What would be the best way to implement SVG's into your project?
If you are using react, there is a tool called SVGR, which will take in an SVG file and return a react component with all the props. This can be really useful if you want to treat SVG more like a markup that will be embedded directly into your HTML. This becomes really helpful when you want to style SVG through props or add transformations and animations. Using SVG directly in markup has so many perks and advantages to the point i don't use them as source in image tags.
-
One way of building an SVG icon library for your project
Really interesting framework agnostic approach, but I think SVGR is a better option for my React homies. It imports an SVG file as a React component. Shouts also to react-icons if Font Awesome, Material Icons and friends are more your bag.
-
Alternative libs to migrate from React to Vue (or Vue to React)
SVGR
-
Power up SVGs with React and CSS
There is another way to import an SVG in Create React App, though. We can import the SVG as a ReactComponent. This is because CRA leverages SVGR to process SVGs.
-
Создаем React-компоненты иконок с помощью Figma API и SVGR. Часть 2.
const { types } = require('@babel/core'); module.exports = { ... template: function svgrCustomTemplate( { imports, interfaces, componentName, props, jsx, exports }, { tpl } ) { // меняем корневой элемент на SvgIcon jsx.openingElement.name.name = 'SvgIcon'; jsx.closingElement.name.name = 'SvgIcon'; // https://github.com/gregberge/svgr/issues/530 // при изменении корневого элемента пропадает спред пропсов // поэтому необходимо добавить спред пропсов самостоятельно jsx.openingElement.attributes.push( types.jSXSpreadAttribute(types.identifier('props')) ); return tpl` ${imports}; import { SvgIcon } from '../SvgIcon'; ${interfaces}; const ${componentName} = (${props}) => ( ${jsx} ); ${exports}; ` } }
-
How can I export an interactive figma component to an interactive react component?
Is this an icon or icon set? Because you can absolutely change SVG icons into react components with SVGR. https://react-svgr.com/