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 v.App to examples #56

Open
DougRzz opened this issue Mar 19, 2020 · 7 comments
Open

Add v.App to examples #56

DougRzz opened this issue Mar 19, 2020 · 7 comments

Comments

@DougRzz
Copy link

DougRzz commented Mar 19, 2020

Please add an example of an App with a navigation drawer and AppBar to the example.ipynb.

I have tried to put something together. See below. But its not quite right yet. I can't work out how to get the content of the app to move when the navigation drawer is activated. Do you know how to fix this?

AppExample

app = v.App(v_model=None)

navDrawer = v.NavigationDrawer(v_model=True, children=[
     v.Select(label='select1', items=[1,2,], prepend_icon = 'fa-truck'), 
    v.TextField(label='text', prepend_icon = 'mdi-heart'), 
    v.Select(label='select3', prepend_icon = 'mdi-magnify')
])
navDrawer.mini_variant = True
navDrawer.expand_on_hover = True

navDrawer.width =300
navDrawer.mini_variant_width = 30

toolBarButton = v.Btn(
                  icon = True, 
                  children=[
                      v.Icon(children=['mdi-dots-vertical'])
                      ]
               )

def on_click(widget, event, data):
   navDrawer.v_model = not navDrawer.v_model

toolBarButton.on_event('click', on_click)


randomButton = v.Btn(
                  icon = False, 
                  children=[
                      v.Icon(children=['mdi-heart']),
                      'Random Button...',
                      ]
               )

appBar = v.AppBar(
      color="deep-purple accent-4",
      dense=True,
      dark = True   ,  
       children = [
           toolBarButton, 
           v.ToolbarTitle(children=['App example']),
]
)

content = v.Container(
#         class_="fill-height",
#         fluid=False,
        children = [
         v.Row(
              align="center",
          justify="center",
#     class_="fill-height",
#         fluid=False,
            children = [randomButton]
                     )
        ])

app.children = [appBar,navDrawer,content]
app
@mariobuikhuizen
Copy link
Collaborator

In Vuetify this is done by setting the app attribute on v-navigation-drawer. Sadly this does not work well inside a notebook, as this sets the NavigationDrawer on the page level, not on the output cell.

In Voila-vuetify the app attribute works as intended, since we are not in a notebook context: https://github.com/voila-dashboards/voila-vuetify#usage. But even then the nav drawer overlaps the content from it's collapsed state when on a small screen.

@nmearl
Copy link

nmearl commented Mar 19, 2020

You can get around this by making sure the absolute property is true. This ensures that the components are attached to the enclosing div instead of the body of the page.

@DougRzz
Copy link
Author

DougRzz commented Mar 20, 2020

@nmearl I couldn't get it to work with the absolute property set to True.

But I found another way to get what i wanted. Now working v nicely.

AppExample2

app = v.App(v_model=None)

navDrawer = v.NavigationDrawer(v_model=True, children=[
     v.Select(label='select1', items=[1,2,], prepend_icon = 'fa-truck'), 
    v.TextField(label='text', prepend_icon = 'mdi-heart'), 
    v.Select(label='select3', prepend_icon = 'mdi-magnify')
])

navDrawer.mini_variant = True
navDrawer.expand_on_hover = True

navDrawer.width =300
navDrawer.mini_variant_width = 30

toolBarButton = v.Btn(
                  icon = True, 
                  children=[
                      v.Icon(children=['mdi-dots-vertical'])
                      ])

def on_click(widget, event, data):
    navDrawer.v_model = not navDrawer.v_model
    if navDrawer.v_model:
        navDrawer.mini_variant_width = 30
    else:
        navDrawer.mini_variant_width = 0
        
toolBarButton.on_event('click', on_click)

randomButton = v.Btn(
                  icon = False, 
                  children=[
                      v.Icon(children=['mdi-heart']),
                      'Random Button...',
                      ])

appBar = v.AppBar(
      color="deep-purple accent-4",
      dense=True,
      dark = True   ,  
       children = [
           toolBarButton, 
           v.ToolbarTitle(children=['App example']),
                    ])

content = v.Col(children = [randomButton,v.TextField(label='text', prepend_icon = 'mdi-heart'), ])


drawersWithContent = v.Container(
        class_="fill-height",
#         fluid=False,
        children = [
                     v.Row(
                          align="top",
                      justify="left",
                        children = [navDrawer,content]
                            )
                ])

app.children = [appBar,drawersWithContent]
app

@mariobuikhuizen
Copy link
Collaborator

Nice! So the trick is putting NavigationDrawer next to Content in a Row?

@DougRzz
Copy link
Author

DougRzz commented Mar 24, 2020

@mariobuikhuizen Yes, putting the NavigationDrawer next to Content in a v.Row seems to do the trick. I will keep this issue open until there is an App ipynb example. I will work on it but I can't promise anything amazing .. relative to the full capabilities of Ipyvuetify . :-)

@nmearl
Copy link

nmearl commented Mar 24, 2020

Ah, I see what you were after. According to Vuetify, this is not the intended way the hover the navigation drawer works; temporarily expanded drawers are supposed to slide over content, not push it apparently. Glad you were able to find a way around that!

@DougRzz
Copy link
Author

DougRzz commented Mar 24, 2020

@nmearl Ah. I think i might be confusing the types of drawers. I was originally trying to replicate the pre-made layouts. e.g. https://vuetifyjs.com/en/examples/layouts/baseline/. I wanted to replicate the behaviour.... where the buttons in the middle adjust to the navigation drawer (and centere justify on the remaining width of content area). But in this other example, https://vuetifyjs.com/en/examples/layouts/complex/ there are also temporary drawers that slide over the content. I think both drawer types are useful.

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

3 participants