Dev.to WebDev ๐Ÿ›  Dev ๐Ÿ‘ 2 ๐Ÿ“– 1 min read

One SVG edit, two apps: React and WPF

The Folder icon in a React app and a Windows WPF app started out with the same shape. Could we change the tab in one SVG and get the same update in both apps? // Detect dark theme var iframe = document.getElement

The Folder icon in a React app and a Windows WPF app started out with the same shape. Could we change the tab in one SVG and get the same update in both apps?

// Detect dark theme var iframe = document.getElementById('tweet-2129147588297535523-352'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2129147588297535523&theme=dark" }

What we changed

  1. We opened folder.svg in IconVectors 2.30 on Windows and moved a path node to reshape the folder tab.
  2. We saved that SVG and generated two outputs from it, a React TypeScript component and XAML for WPF.
  3. We integrated the new outputs, refreshed the React app in the browser, and relaunched the native WPF app.

Both apps showed the same reshaped tab. The cover image shows the two results side by side.

What each app needed

  • React: We adapted the generated JSX syntax to fit the demo component.
  • WPF: We resolved the SVG's currentColor to a WPF brush.

Those adjustments preserved the exported path geometry. For the next shape change, edit folder.svg, regenerate both outputs, and check the icon in each running app.

React TypeScript export guide ยท XAML export guide for WPF

Disclosure: we build IconVectors at Axialis.

๐Ÿ“ฐ Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.