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

Add dropdown component #157

Merged
merged 22 commits into from
May 31, 2023
Merged

Add dropdown component #157

merged 22 commits into from
May 31, 2023

Conversation

cavasinf
Copy link
Collaborator

@cavasinf cavasinf commented Apr 24, 2023

Description

Add dropdown component

dropdown

<style>
    .dropdown-menu-demo {
        display: inline-block;
        width: 100%;
        position: relative;
        top: 0;
        margin-bottom: 1rem !important;
    }
</style>

<div class="row">
        <div class="col-sm-6 col-lg-3">
            {{ dropdown([
                {
                    type: 'header',
                    title:'Dropdown header',
                },
                {
                    title: 'Item 1',
                    icon: 'about',
                },
                {
                    title: 'Item 2',
                    icon: 'admin',
                },
                {
                    type: 'html',
                    html: '
            <a href="#" class="text-reset">My profile</a>
            <label class="form-check m-0 ms-auto">
                <input type="checkbox" class="form-check-input">
                Public
            </label>
        '
                },
                {
                    type: 'radio',
                    title: 'Radio input',
                    html: '<input class="form-check-input m-0 me-2" type="radio">'
                },
                {
                    type: 'checkbox',
                    title: 'Checkbox input',
                    html: '<input class="form-check-input m-0 me-2" type="checkbox">',
                },
                {
                    type: 'checkbox',
                    title: 'Checkbox input',
                    html: '<input class="form-check-input m-0 me-2" type="checkbox">',
                    disabled: true,
                },
                {
                    type: 'checkbox',
                    title: 'Checkbox input',
                    html: '<input class="form-check-input m-0 me-2" type="checkbox">',
                    active: true,
                },
                {
                    type: 'switch',
                    title: 'Checkbox input',
                    html: '<input class="form-check-input m-0 me-2" type="checkbox">'
                },
                {
                    type: 'divider',
                },
                {
                    title: 'Dropdown item 1',
                },
                {
                    title: 'Dropdown item 2',
                },
                {
                    title: 'Dropdown disabled',
                    disabled: true,
                },
                {
                    title: 'Dropdown active',
                    active: true,
                },
                {
                    type: 'divider',
                },
                {
                    title: 'Kevin Papst',
                    html: '<span class="avatar avatar-xs rounded me-2" style="background-image: url(https://avatars.githubusercontent.com/u/533162)"></span>'
                },
                {
                    title: 'Florian Cavasin',
                    html: '<span class="avatar avatar-xs rounded me-2" style="background-image: url(https://avatars.githubusercontent.com/u/25293190)"></span>'
                },
                {
                    title: 'Firstname Lastname',
                    html: '<span class="avatar avatar-xs rounded me-2">FL</span>'
                },
                {
                    type: 'divider',
                },
                {
                    title: 'Logout',
                    icon: 'back',
                },
            ], {extraClass : 'dropdown-menu-demo', menuArrow: true, menuArrowEnd: true}) }}
        </div>
        <div class="col-sm-6 col-lg-3">
            {{ dropdown([
                {
                    type: 'header',
                    title:'With arrow',
                },
                {
                    title: 'Action',
                },
                {
                    title: 'Another action',
                },
            ], {extraClass : 'dropdown-menu-demo', menuArrow: true}) }}

            {{ dropdown([
                {
                    type: 'header',
                    title:'With arrow end',
                },
                {
                    title: 'Action',
                },
                {
                    title: 'Another action',
                },
            ], {extraClass : 'dropdown-menu-demo', menuArrow: true, menuArrowEnd: true}) }}

            {{ dropdown([
                {
                    type: 'header',
                    title:'With badge',
                },
                {
                    title: 'Action',
                    badge: {text: '12', class: 'bg-primary'}
                },
                {
                    title: 'Another action',
                    badge: {class: 'bg-success'}
                },
            ], {extraClass : 'dropdown-menu-demo'}) }}

            {{ dropdown([
                {
                    type: 'header',
                    title:'Dark background',
                },
                {
                    title: 'Action',
                },
                {
                    title: 'Another action',
                },
                {
                    title: 'Dropdown disabled',
                    disabled: true,
                },
                {
                    title: 'Dropdown active',
                    active: true,
                },
                {
                    type: 'divider',
                },
                {
                    title: 'Dropdown item 1',
                    badge: {text: '2', class: 'bg-primary'}
                },
            ], {extraClass : 'dropdown-menu-demo bg-dark text-white', menuArrow: true, menuArrowEnd: true}) }}
        </div>
    </div>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I updated the documentation (see here)
  • I agree that this code will be published under the MIT license

@cavasinf cavasinf added Status: Needs Review Not under investigation Feature Feature requested labels Apr 24, 2023
@cavasinf cavasinf added this to the 1.1 milestone Apr 24, 2023
@cavasinf cavasinf marked this pull request as ready for review April 24, 2023 10:15
@cavasinf
Copy link
Collaborator Author

Good to go then 👍

@kevinpapst
Copy link
Owner

Can I stack dropdowns for child-menus?

@cavasinf
Copy link
Collaborator Author

WDYM?

Like a sub dropdown?
image

@kevinpapst
Copy link
Owner

WDYM?
Like a sub dropdown?

That 👍

If prepare examples in the demo app, I'd include one if possible.

@cavasinf
Copy link
Collaborator Author

Yeah I've thought to implement it.
But I soon I've tested it with raw HTML, there's something wrong with the badge:
image

But I can add it without the badge though (ATM)

weblate and others added 11 commits May 31, 2023 13:38
Co-authored-by: ButterflyOfFire <boffire@users.noreply.hosted.weblate.org>
Co-authored-by: Ema Panz <thepanz@gmail.com>
Co-authored-by: yangyangdaji <1504305527@qq.com>
* theme usage for navbars
* bootstrap 5.3 - replace deprecated text-muted class
* bump to tabler beta 19 (mainly navbar and dark mode fixes)
@kevinpapst kevinpapst merged commit c2a8113 into main May 31, 2023
3 checks passed
@kevinpapst kevinpapst deleted the cavasinf-dropdown branch May 31, 2023 11:48
@kevinpapst
Copy link
Owner

Thanks 👍

I added your HTML examples to the demo app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature requested Status: Needs Review Not under investigation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants