diff --git a/apps/cards.py b/apps/cards.py index d7d0fb0e..47c08139 100644 --- a/apps/cards.py +++ b/apps/cards.py @@ -504,6 +504,7 @@ def card_id(pdf): id='download_json', variant="outline", color='indigo', + compact=True, leftIcon=[DashIconify(icon="mdi:code-json")], ), dmc.Button( @@ -511,18 +512,26 @@ def card_id(pdf): id='download_votable', variant="outline", color='indigo', + compact=True, leftIcon=[DashIconify(icon="mdi:xml")], ), + help_popover( + [ + dcc.Markdown('You may also download the data programmatically.'), + download_tab, + dcc.Markdown('See {}/api for more options'.format(APIURL)), + ], + 'help_download', + trigger=dmc.ActionIcon( + DashIconify(icon="mdi:help"), + id='help_download', + variant="outline", + color='indigo', + ), + ), html.Div(objectid, id='download_objectid', className='d-none'), html.Div(APIURL, id='download_apiurl', className='d-none'), ], position="center" - ), - help_popover( - [ - dcc.Markdown('You may also download the data programmatically.'), - download_tab, - dcc.Markdown('See {}/api for more options'.format(APIURL)), - ], 'help_download' ) ], ), diff --git a/apps/utils.py b/apps/utils.py index 6138cd56..62822912 100644 --- a/apps/utils.py +++ b/apps/utils.py @@ -853,16 +853,22 @@ def loading(item): zIndex=100000 ) -def help_popover(text, id): +def help_popover(text, id, trigger=None, className=None): """ Make clickable help icon with popover at the bottom right corner of current element """ + + if trigger is None: + trigger = html.I( + className="fa fa-question-circle fa-1x", + id=id, + ) + if className is None: + className = "d-flex align-items-end justify-content-end" + return html.Div( [ - html.I( - className="fa fa-question-circle fa-1x", - id=id, - ), + trigger, dbc.Popover( dbc.PopoverBody( text, @@ -873,5 +879,5 @@ def help_popover(text, id): style={'width': '80vw', 'max-width': '800px'}, className='shadow-lg' ), - ], className="d-flex align-items-end justify-content-end" + ], className=className )