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

feat: include code snippet in preview comment #1973

Conversation

jguddas
Copy link
Member

@jguddas jguddas commented Mar 10, 2024

What is the purpose of this pull request?

  • New Icon
  • Bug fix
  • New Feature
  • Documentation update
  • Other:

Description

It's hard to use the icons before they are release, this change makes early testing and adoption easier.

Before Submitting

@jguddas
Copy link
Member Author

jguddas commented Mar 10, 2024

Example

Added or changed icons

icons/apple.svgicons/book.svg

Preview cohesion icons/square-arrow-out-up-left.svgicons/power-square.svg
icons/apple.svgicons/book.svg
icons/swatch-book.svgicons/ruler.svg
Preview stroke widths icons/apple.svgicons/book.svg
icons/apple.svgicons/book.svg
icons/apple.svgicons/book.svg
DPI Preview (24px) icons/apple.svg icons/book.svg
Icon X-rays icons/apple.svg icons/book.svg

Icons as code

const AppleIcon = createLucideIcon('Apple', [
  ["path",{"d":"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z"}],
  ["path",{"d":"M10 2c1 .5 2 2 2 5"}]
])

const BookIcon = createLucideIcon('Book', [
  ["path",{"d":"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"}]
])

@jguddas jguddas force-pushed the feat/include-code-snippet-in-preview-comment branch from 8b5f444 to ef9e074 Compare March 10, 2024 16:47
Copy link
Member

@ericfennis ericfennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, can we also wrap this in a details+summary.
Because if we add, change or optimize a whole list for icons we will get a very large list of code examples.

@ericfennis
Copy link
Member

Hmm this code example only will only work for packages that uses the createLucideIcon function.
For the packages lucide-angular, lucide-solid, lucide-svelte this will not work.
We should put a text message below it to make that clear.

@jguddas
Copy link
Member Author

jguddas commented Mar 14, 2024

Hmm this code example only will only work for packages that uses the createLucideIcon function. For the packages lucide-angular, lucide-solid, lucide-svelte this will not work. We should put a text message below it to make that clear.

Sure, any plans to add createLucideIcon for those packages?

@ericfennis
Copy link
Member

@jguddas Unfortunately It's not possible for lucide-svelte, lucide-solid, and lucide-angular maybe. Svelte can only work with .svelte component files.
But I'm working on a general Icon component with support for icon nodes. Which will have support for all packages.

@ericfennis ericfennis merged commit 4c65876 into lucide-icons:main Apr 2, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants