Fractal: Showcase different use-cases for a component

Created on 21 Sep 2016  Â·  5Comments  Â·  Source: frctl/fractal

I'm building a carousel component and would like to showcase each use-case of said component without duplicating markup in my handlebars file. I wouldn't consider them variations, the component itself will have the same markup it's what's inside the carousel component that's changing. e.g., carousel slides with images, carousel slides with an image and a link, carousel slides with product info cards within them, etc. What would a config file look for something like this? How can I display all these use-cases in the Web UI without duplicating templates?

feature-request

Most helpful comment

Hey guys, really sorry for the slow replies. @coreybruyere as @brettgullan says you can currently indeed use variants for this sort of thing. However I am in agreement with @gui-gui that there is a difference between variants and 'scenarios', and that it would be good to have some way to differentiate (and/or combine) these two use-cases.

I'm going to have a think about how this could be best implemented, but until then the best you can do is use variants for these I'm afraid.

All 5 comments

@coreybruyere You could do this using Variant context data and some logic within your templates. See docs here for Variant context structure.

I've considered the same situation in this issue #149 .
I also think that a variant is not an ideal solution.

+1 for implementing a feature like this

I guess a good way to use something like this would be to implement contexts and use it instead of context inside component.config.json. You would than be able to select from a select menu in the Web UI which context you would like to render. Unfortunately i'm not able to implement such a thing.

{
    "contexts": [ 
    { 
        description: "This describes this context",
        context: {
            ... context here ...
        }
    },
    { 
        description: "This describes another context",
        context: {
            ... context here ...
        }
    }
    ]
}

Hey guys, really sorry for the slow replies. @coreybruyere as @brettgullan says you can currently indeed use variants for this sort of thing. However I am in agreement with @gui-gui that there is a difference between variants and 'scenarios', and that it would be good to have some way to differentiate (and/or combine) these two use-cases.

I'm going to have a think about how this could be best implemented, but until then the best you can do is use variants for these I'm afraid.

Themes would also be of benefit to me too. 😃 have a multi retailer I am working with.

Sent from my iPhone

On 26 Sep. 2016, at 6:27 pm, Mark Perkins [email protected] wrote:

Hey guys, really sorry for the slow replies. @coreybruyere as @brettgullan says you can currently indeed use variants for this sort of thing. However I am in agreement with @gui-gui that there is a difference between variants and 'scenarios', and that it would be good to have some way to differentiate (and/or combine) these two use-cases.

I'm going to have a think about how this could be best implemented, but until then the best you can do is use variants for these I'm afraid.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Closing this as I think it's covered by the feature request in #149

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Maybach91 picture Maybach91  Â·  5Comments

patphongs picture patphongs  Â·  5Comments

julmot picture julmot  Â·  3Comments

allmarkedup picture allmarkedup  Â·  3Comments

allmarkedup picture allmarkedup  Â·  5Comments