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

feat: Select component #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

webfansplz
Copy link
Member

select-component.mov
<template borderStyle="round">
  <Select v-model="value" @submit="submit">
    <Option :value="item.value" v-for="(item, index) in options" :key="index">
      <template v-slot="{ isActive }">
        <Box flexDirection="column">
          <Text :dimmed="isActive" :underline="isActive">{{ item.label }}</Text>
        </Box>
      </template>
    </Option>
  </Select>
</template>

@netlify
Copy link

netlify bot commented Oct 31, 2022

Deploy Preview for vue-termui ready!

Name Link
🔨 Latest commit d111cb6
🔍 Latest deploy log https://app.netlify.com/sites/vue-termui/deploys/635fcd5ec6311b000946d145
😎 Deploy Preview https://deploy-preview-18--vue-termui.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.

@webfansplz webfansplz requested a review from posva October 31, 2022 13:29
Copy link
Collaborator

@posva posva left a comment

Choose a reason for hiding this comment

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

I wonder if this should be really different: like the input component, it does look a lot like the prompts version but it could be so much more. I wonder if by having relative + absolute positioned boxes we could recreate the select menu that exists on the browser and cycle through them with tab (using the useFocusable())
we could also have both versions but I don't think we should have the submit event for example, that should be handled at a higher level

I think I need to write one of these to better explain what I mean by something really interactive. I will try to give the select a try and open a new PR if you want?

type: [String, Number],
required: true,
},
indicator: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think this is more interesting that having two different props?

},
})

export const TuiOption = defineComponent({
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think they can each of them have their own file 😄

Comment on lines +30 to +36
<Option :value="item.value" v-for="(item, index) in options" :key="index">
<template v-slot="{ isActive }">
<Box flexDirection="column">
<Text :dimmed="isActive" :underline="isActive">{{ item.label }}</Text>
</Box>
</template>
</Option>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, this should look like this:

Suggested change
<Option :value="item.value" v-for="(item, index) in options" :key="index">
<template v-slot="{ isActive }">
<Box flexDirection="column">
<Text :dimmed="isActive" :underline="isActive">{{ item.label }}</Text>
</Box>
</template>
</Option>
<Option :value="item.value" v-for="(item, index) in options" :key="index">
{{ item.label }}
</Option>

and even allow not passing the value prop. We can achieve this by using inject/provide. The v-slot api is nice to allow the user further customization though

@webfansplz
Copy link
Member Author

I wonder if this should be really different: like the input component, it does look a lot like the prompts version but it could be so much more. I wonder if by having relative + absolute positioned boxes we could recreate the select menu that exists on the browser and cycle through them with tab (using the useFocusable()) we could also have both versions but I don't think we should have the submit event for example, that should be handled at a higher level

I think I need to write one of these to better explain what I mean by something really interactive. I will try to give the select a try and open a new PR if you want?

Sure,It's nice to see the PR.

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