[RFC] Add prebundled icons #16
Replies: 6 comments 5 replies
-
I've implemented this in the above pattern with a python script and some manual changes to fix things like Edit: I'm just patching this into my repo by changing the module to |
Beta Was this translation helpful? Give feedback.
-
I love this. I didn't think it was possible to dynamically call these icons for some reason. I think I'll do it a little differently by returning a type [<Erase>] bundleHelper =
static member inline expandImport (value : string) =
let filled = import $"{value}Filled" FluentIcons |> unbox<BundleIcon>
let regular = import $"{value}Regular" FluentIcons |> unbox<BundleIcon>
{ Filled = filled; Regular = regular } Then when bundling like normal, all you'd have to do is: let AlertIcon = Fui.bundleIcon bundleIcons.alert
AlertIcon [] and instead of I feel like this creates the least amount of breaking changes and still allows the user to use the ratings properties like before. Plus, I'm cutting out like 2,500 lines of code which is awesome. |
Beta Was this translation helpful? Give feedback.
-
Added this to v1.18.0 that I just pushed! |
Beta Was this translation helpful? Give feedback.
-
Damnit, I was under the impression that less code means a smaller package size. This actually increased the package size by roughly 10%. That's what I get for making assumptions. |
Beta Was this translation helpful? Give feedback.
-
Woof, I'm using the update which is great, but should maybe consider sticking this into a major release or something. The new bundleIcons is a breaking change (considering the old syntax won't work anymore). |
Beta Was this translation helpful? Give feedback.
-
@shayanhabibi Hey, I just want your honest opinion on something. When making these Do you think that adding this
type [<Erase>] bundleIcons =
static member inline import (iconName: string) =
import $"{iconName}" FluentIcons |> unbox<BundleIcon>
Fui.bundleIcon { Filled = bundleIcons.import "LayoutColumnThreeFocusLeftFilled"; Regular = bundleIcons.accessTime.Regular } |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A common pattern in usage of icons in FluentUI is to bundle two icons which may present under different circumstances (such as the filled icon being rendered when the item is hovered).
By a large majority, this simply results in users bundling the filled and regular versions of the same icon.
My idea is to add a separate type which helps reduce boiler plate object definition.
Implementation:
Usage:
Alternatively:
Implementation:
Usage:
I am happy to implement this and make a pull request pending on thoughts
Beta Was this translation helpful? Give feedback.
All reactions