madeleine-patience / Considerate-Cat-Version-2-With-Next

Considerate Cat Version 2
https://conisderate-cat-version-2.vercel.app
2 stars 0 forks source link

Refactored purrlaroid further #35

Closed arthvadrr closed 2 months ago

arthvadrr commented 2 months ago

This is what was meant to be a commit to your previous pull request for Purrlaroid.

I further simplified the component in index.tsx so we can import Purrlaroid instead of Root and Title into CatDirectory.

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
conisderate-cat-version-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 3, 2024 4:36pm
considerate-cat-version-2-with-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 3, 2024 4:36pm
arthvadrr commented 2 months ago

Yes, we could conditionally render the Title. Something like:


const Purrlaroid: StoryFn = ({catImage, catName}) => (
    <PurrlaroidRoot catImage={catImage} isAnimated>
        {catName &&
            <PurrlaroidTitle catName={catName}/>
        }
    </PurrlaroidRoot>
);

catName would be optional and Title would only render if it were present. This could be done in a few different ways.
madeleine-patience commented 2 months ago

Yes, we could conditionally render the Title. Something like:

const Purrlaroid: StoryFn = ({catImage, catName}) => (
    <PurrlaroidRoot catImage={catImage} isAnimated>
        {catName &&
            <PurrlaroidTitle catName={catName}/>
        }
    </PurrlaroidRoot>
);

catName would be optional and Title would only render if it were present. This could be done in a few different ways.

I see, so we render the whole component as one big piece and then when we use it the conditional renders will show through if we choose to have those parts show.