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

fix(select): rendering card slots #181

Merged
merged 4 commits into from
Jun 6, 2023

Conversation

IcetCode
Copy link
Contributor

@IcetCode IcetCode commented Jun 5, 2023

@netlify
Copy link

netlify bot commented Jun 5, 2023

Deploy Preview for anu-vue ready!

Name Link
🔨 Latest commit d3df377
🔍 Latest deploy log https://app.netlify.com/sites/anu-vue/deploys/647f75729a70340008492581
😎 Deploy Preview https://deploy-preview-181--anu-vue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jd-solanki
Copy link
Owner

Hi @IcetCode

Thanks for your PR. Actually, the Original issue lies in how we pass down the slots to the child & typography component.

Issue with passing down slots via the current mechanism

ATM we are doing something like below in almost all the components due to atomic behavior of anu:

        <!-- ℹ️ Recursively pass down slots to child -->
        <template
          v-for="(_, name) in aCardTypographySlots"
          #[name]="slotProps"
        >
          <slot
            :name="name"
            v-bind="slotProps"
          />
        </template>

However, down side of this approach is we are using the child component's slot & redefining it in the parent component. This is fine for most of the case but fails where we conditionally checks for slot usage like in Typography component.


Hence, we need to filter the slots before passing them down. The quickest way is adding v-if to the loop which is against the style guide of vue:

        <!-- ℹ️ Recursively pass down slots to child -->
        <template
          v-for="(_, name) in aCardTypographySlots"
          v-if="$slots[name]"
          #[name]="slotProps"
        >
          <slot
            :name="name"
            v-bind="slotProps"
          />
        </template>

This works but following the style guide, we need some computed properties like yours. hence, I updated the PR for this. Will perform changes in the rest of the components with this new composable to avoid issues.

@jd-solanki
Copy link
Owner

BTW, I wounder how you are able test the components ATM 🤔

Tests aren't working 🤷🏻‍♂️

@jd-solanki jd-solanki merged commit 4ba3821 into jd-solanki:main Jun 6, 2023
3 checks passed
@IcetCode
Copy link
Contributor Author

IcetCode commented Jun 6, 2023

I removed the browser mode from vitest.config.ts, considering we are waiting for its new PR, I have not committed this change yet.

jd-solanki added a commit that referenced this pull request Jun 7, 2023
@IcetCode IcetCode deleted the fix/select-card-slots branch June 13, 2023 06:05
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.

None yet

2 participants