Skip to content

[WIP] Add Banner component #112

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

Closed
wants to merge 2 commits into from
Closed

[WIP] Add Banner component #112

wants to merge 2 commits into from

Conversation

arthurxavierx
Copy link
Contributor

No description provided.

}

actionBanner :: Array JSX -> PropsModifier BannerProps
actionBanner actions f =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if this would be better as a LumiComponent instead of a PropsModifier.

Copy link
Member

Choose a reason for hiding this comment

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

This does seem like a strange way to use it.. hmm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think so too. Would you prefer having it as a LumiComponent?

data Banner = Banner

type BannerProps =
( component :: Banner
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't export the single constructor of the Banner data type so a banner can be identified in a PropsModifier as forall props. PropsModifier (component :: Banner | props).

Copy link
Member

Choose a reason for hiding this comment

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

This is an interesting idea, but I'm not sure it's really necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is necessary if actionBanner is a LumiComponent, so that we can apply all of the modifiers that work on banner on it too.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I follow.. wouldn't it work on any component with the same prop shape?

Copy link
Contributor Author

@arthurxavierx arthurxavierx Dec 20, 2019

Choose a reason for hiding this comment

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

Yes, but actionBanner wouldn't have the same prop shape as banner if it were a LumiComponent:

type BannerProps =
  ( dismissable :: Boolean
  , content :: Array JSX
  )

type ActionBannerProps =
  ( dismissable :: Boolean
  , actions :: Array JSX
  , content :: Array JSX
  )

data Banner = Banner

type BannerProps =
( component :: Banner
Copy link
Member

Choose a reason for hiding this comment

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

This is an interesting idea, but I'm not sure it's really necessary.

}

actionBanner :: Array JSX -> PropsModifier BannerProps
actionBanner actions f =
Copy link
Member

Choose a reason for hiding this comment

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

This does seem like a strange way to use it.. hmm

, desktopQuery $ css
{ padding: str "12px 24px"
}
]
Copy link
Member

Choose a reason for hiding this comment

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

Nice, this api really shines here

{ "@media (min-width: 860px)": nested style
}

onDesktop :: forall props. PropsModifier () -> PropsModifier props
Copy link
Member

Choose a reason for hiding this comment

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

Should props be passed to both of these types, or props1 and props2? The empty row seems restrictive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't have an open row here, otherwise we wouldn't be able to apply the argument to the props set, because we don't know what it is. It's not restrictive given that this should only work for styles anyway, and style modifiers are always forall props. PropsModifier props.

@arthurxavierx
Copy link
Contributor Author

Closing this since the work is being done in #143 now

@arthurxavierx arthurxavierx deleted the arthur/banner branch May 4, 2020 14:48
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.

2 participants