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

Add support for material-icons #40

Merged
merged 4 commits into from
Dec 16, 2021

Conversation

pocharlebois
Copy link
Contributor

@pocharlebois pocharlebois commented Dec 14, 2021

  • Based on the npm https://github.com/marella/material-icons
  • All material icons as of 1.10.4 in an enum - ie: pie_chart ->
    PieChart("pie_chart") in MDCIconOpts.MDCIconType
  • Numbers written out using Proper Case 1MP -> OneMp
  • Output is a Span with the right class (Filled, Outlined, TwoTone, etc)
  • As elsewhere in KMDC, styling has to be applied externally

Closes #33

Copy link
Owner

@mpetuska mpetuska left a comment

Choose a reason for hiding this comment

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

Great work. Left some minor comments for you to address.

README.md Outdated Show resolved Hide resolved
lib/kmdc-icon/build.gradle.kts Outdated Show resolved Hide resolved
lib/kmdc-icon/build.gradle.kts Outdated Show resolved Hide resolved
lib/kmdc-icon/src/jsMain/kotlin/MDCIcon.kt Outdated Show resolved Hide resolved
lib/kmdc-icon/src/jsMain/kotlin/MDCIcon.kt Outdated Show resolved Hide resolved
* Based on the npm https://github.com/marella/material-icons
* All material icons as of 1.10.4 in an enum - ie: pie_chart ->
  PieChart("pie_chart") in MDCIconOpts.MDCIconType
* Numbers written out using Proper Case 1MP -> OneMp
* Output is a Span with the right class (Filled, Outlined, TwoTone, etc)
* As elsewhere in KMDC, styling has to be applied externally
Copy link
Owner

@mpetuska mpetuska left a comment

Choose a reason for hiding this comment

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

Almost there :)

lib/kmdc-icons/src/jsMain/kotlin/MDCIcon.kt Outdated Show resolved Hide resolved
@mpetuska
Copy link
Owner

As a side note, it would be good if you could stop force-pushing as it often messes up github links, even for linear history. Not a deal-breaker otherwise.

*/
@MDCDsl
@Composable
public fun MDCIcon(opts: Builder<MDCIconOpts>? = null) {
Copy link
Owner

Choose a reason for hiding this comment

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

Oof, missed it first time around, but since we're wrapping a single html element, it's always a good practice to expose attrs and content builder functions. Have a look at MDCButton for an example how it's done ;)

@rocketraman
Copy link
Contributor

As a side note, it would be good if you could stop force-pushing as it often messes up github links, even for linear history. Not a deal-breaker otherwise.

Sorry @mpetuska our internal workflow for branches is to force push them to keep the history clean. Would you prefer "fixup!" and "squash!" commits during the review process with a final rebase before merge, or do you prefer branches keep a simple linear history, mistakes and all?

@mpetuska
Copy link
Owner

Well I'm squashing all commits when merging pr anyways to keep pr to commit ratio consistent on master. Not force-pushing to pr branches would make gh permalinks less flakey. But as I said before, this is not a deal breaker, but just my preference.

@mpetuska
Copy link
Owner

mpetuska commented Dec 16, 2021

@pocharlebois looks like you pushed a change I requested, but then overridden it with force-push (exactly why I'm not a fan of force-pushing anywhere :D). I've looked at the first push and it is forwarding attrs fine. One more thing that came to mind is new opt

enum class MDCIconBase{Span, I}
//=======
var base: MDCIconBase = MDCIconBase.Span

This would allow people to change base element since mdc-icons supports both, <span> and <i>

@mpetuska
Copy link
Owner

But I'm happy to ignore base opt as this stage as it can be enhanced later. I'll leave it up to you to decide when you want to merge this.

@rocketraman
Copy link
Contributor

But I'm happy to ignore base opt as this stage as it can be enhanced later. I'll leave it up to you to decide when you want to merge this.

I suspect @pocharlebois would rather merge this as-is, and leave the base opt for later enhancement.

@mpetuska mpetuska merged commit f2505ee into mpetuska:master Dec 16, 2021
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.

Implement kmdc-icons
3 participants