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

Expose list of components #41

Open
ldstreet opened this issue Jan 22, 2019 · 3 comments
Open

Expose list of components #41

ldstreet opened this issue Jan 22, 2019 · 3 comments

Comments

@ldstreet
Copy link

Just like text styles and colors, components should be exposed as an array.

@dirtybit
Copy link
Contributor

dirtybit commented Oct 9, 2019

Hey @ldstreet,
Each component has a spec data and there usually a large number of components in projects/styleguides. So, even the list of components can be exposed as an array, it's not easy to expose the actual spec data for all components since fetching them eagerly would result in high network traffic and very long loading times.

The good news is that we're working hard on Public API, so this data will be accessible through the API for each individual component in a project/styleguide.

Can you share the use cases you have in mind so that we can understand the requirements better?

@ldstreet
Copy link
Author

ldstreet commented Oct 10, 2019

This sounds great.

I am looking to write a tool that can export a style guide into json representation that is then consumed by a styling layer in our iOS client. The JSON has nodes for colors, text styles, and components. The a shortened example of the necessary output looks like this:

{
    "colorPalette" : {
        "color1" : {
            "red" : 15,
            "green" : 74,
            "blue" : 145,
            "alpha" : 1.0
        },
        "color2" : {
            "red" : 109,
            "green" : 112,
            "blue" : 136,
            "alpha" : 1.0
        }
    },
    "textStyles" : {
        "text1" : {
            "font" : {
                "size" : 32.0,
                "weight" : "regular"
            },
            "textColorKey" : "color1"
        },
        "text2" : {
            "font" : {
                "size" : 32.0,
                "weight" : "regular"
            },
            "textColorKey" : "color2"
        },
    },
    "labelStyles" : {
        "label1" : {
            "textStyleKey" : "text1",
            "backgroundColorKey" : "color1"
        },
        "label2" : {
            "textStyleKey" : "text2",
            "backgroundColorKey" : "color2",
            "borderWidth" : 2,
            "borderColorKey" : "color1"
        }
    },
    "compositeViewStyles" : {
        "compositeView1" : {
            "topLabelStyleKey" : "label1",
            "bottomLabelStyleKey" : "label2"
        }
    }
}


The end result is being able to easily style any component like this:

let label = Label().styled(as: .label1)
let compositeView = CompositeView(top: "hi", bottom: "there").styled(as: .compositeView1)

@ldstreet
Copy link
Author

ldstreet commented Jun 3, 2020

Hello, I noticed that y’all have released your API but it seems like support for this feature is still missing. Is it planned to be added in the future? Thanks!

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

No branches or pull requests

2 participants