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

A sidebar component #69

Open
the-halfbloodprince opened this issue Oct 12, 2021 · 2 comments
Open

A sidebar component #69

the-halfbloodprince opened this issue Oct 12, 2021 · 2 comments

Comments

@the-halfbloodprince
Copy link
Contributor

A sidebar component usually seen in dashboards.

The component must be this way:

Javascript

const myOptions = [
    {
        'name': 'My-App',
        'onClick': undefined,
        'clickable': false,
        'icon': '/logo.png'
    },
    {
        'name': 'Dashboard',
        'onClick': () => {
            console.log('Landed on dashboard')
        },
        'clickable': true,
        'icon': '/dash.png'
    },
    {
        'name': 'Results',
        'onClick': () => {
            console.log('Landed on results page')
        },
        'clickable': true,
        'icon': '/results.png'
    },
    {
        'name': 'Help',
        'onClick': () => {
            console.log('Landed on help page')
        },
        'clickable': true,
        'icon': '/help.png'
    },
]

<Sidebar options={myOptions} />

TypeScript

interface option {
    name: string;                                    //name to be displayed on the UI
    onClick: () => void | undefined;       // function that will be called on clicking the option
    clickable: boolean | undefined;        // is the button clickable
    icon: string | undefined;                   // icon path
}

let myOptions: option[] = [
    {
        'name': 'My-App',
        'onClick': undefined,
        'clickable': false,
        'icon': '/logo.png'
    },
    {
        'name': 'Dashboard',
        'onClick': () => {
            console.log('Landed on dashboard')
        },
        'clickable': true,
        'icon': '/dash.png'
    },
    {
        'name': 'Results',
        'onClick': () => {
            console.log('Landed on results page')
        },
        'clickable': true,
        'icon': '/results.png'
    },
    {
        'name': 'Help',
        'onClick': () => {
            console.log('Landed on help page')
        },
        'clickable': true,
        'icon': '/help.png'
    }
]

<Sidebar options={myOptions} />

The fixing of the element to the side can be skipped, it just needs to have a height of 100vh;

@fgkolf
Copy link

fgkolf commented Oct 16, 2021

Hello! can i grab this one?

@the-halfbloodprince
Copy link
Contributor Author

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants