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

Phantom border #412

Merged
merged 13 commits into from
Apr 26, 2018
Merged

Phantom border #412

merged 13 commits into from
Apr 26, 2018

Conversation

owanturist
Copy link

Hi @rtfeldman! I'm glad to show border properties as a part of #392 here. Please take a look.

Checklist

  • Each Value is an open record with a single field. The field's name is the value's name, and its type is Supported. For example foo : Value { provides | foo : Supported }
  • Each function returning Style accepts a closed record of Supported fields, which always includes inherit, initial, and unset because all CSS properties support those three values! For example, borderFoo : Value { foo : Supported, bar : Supported, inherit : Supported, initial : Supported, unset : Supported } -> Style
  • Every exposed value has documentation which includes at least 1 code sample.
  • Documentation links to to a CSS Tricks article if available, and MDN if not.
  • Make a pull request against the phantom-types branch, not master!

Copy link
Author

@owanturist owanturist left a comment

Choose a reason for hiding this comment

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

@rtfeldman there are some points which I need for you comment/opinion, could you pay little bit more attention for those please?

src/Css.elm Outdated
-}
wavy : Value { provides | wavy : Supported }
wavy =
Value "wavy"
Copy link
Author

Choose a reason for hiding this comment

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

I've removed wavy value, because it's related with text-decoration-style which hasn't implemented yet and I thought it can confuse a contributor who will implement it. Should we keep changes or come wavy back?

Copy link
Owner

Choose a reason for hiding this comment

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

I think it's fine to leave it. It already happens that implementors run into things that have already been implemented (e.g. left is reused in several places), so I think this should be fine!


## Border Color

@docs borderColor, borderColor2, borderColor3, borderColor4, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor
Copy link
Author

Choose a reason for hiding this comment

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

I'm little bit worry about the docs structure but this kind of approach the most logical and clear by my opinion.

Copy link
Owner

Choose a reason for hiding this comment

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

This grouping seems fine to me! 👍

src/Css.elm Outdated
type Supported
= Supported
type alias Supported =
Never
Copy link
Author

Choose a reason for hiding this comment

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

Little proposition for making phantom types more phantom :) Like never before.

Copy link
Author

Choose a reason for hiding this comment

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

Actually there are more variants:

  1. If we don't want that user will describe phantom types of Value with both Never and Supported
    type Supported
    	= Supported Never
  2. We may not use any special type, just empty tuple. Error messages keep same.
    dotted : Value { provides | dotted : () }
    dotted =
        Value "dotted"

Copy link
Owner

Choose a reason for hiding this comment

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

A nice feature of having Supported be a union type that doesn't expose its constructor is that other modules can't instantiate it. This limits how other modules can use it, which in this case is desirable!

On the other hand, Never and () can be instantiated outside this module (by using Basics.never and (), respectively), which means we're potentially giving up guarantees around how these values can be constructed, without necessarily knowing what those guarantees are are or why we're giving them up. 😅

To make a long story short, I definitely want to leave this as-is! 😄

Copy link
Author

Choose a reason for hiding this comment

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

Anyway we will never expose constructor of Value. It means that nobody can reproduce something like that Value "transparent" event we expose Supported(..)

@owanturist
Copy link
Author

@rtfeldman issues have been completed

Copy link
Owner

@rtfeldman rtfeldman left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you so much @owanturist!!! 😍


borderStyle ridge

Similar to `groove`, but reverses the color values in a way that makes the element appear raised.
Copy link
Owner

Choose a reason for hiding this comment

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

Love the concise descriptions on these! 😻

@rtfeldman rtfeldman merged commit 2a9d577 into rtfeldman:phantom-types Apr 26, 2018
@owanturist owanturist deleted the phantom-border branch April 26, 2018 02:26
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