AnswerDotAI / AnswerDotAI/MonsterUI
LightboxItem Caption not passed to element & NavBar Sticky "top"
- Dominant language
- Jupyter Notebook
- Stars
- 522
- Forks
- 33
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Noticed a couple of very minor things:
## data_caption
Adding a "data_caption" to a LightboxItem should pass its content to the caption once the lightbox is active:
```python
# my code
LightboxItem(
Img(
src=thumb_url,
),
href=full_url,
data_attrs=f"id: {m['id']}",
data_caption=make_caption(m),
)
```
Looks like it's declared in the inputs of the LightboxItem, but not returned:
```python
# nbs/02_franken.ipynb:3437
"def LightboxItem(*c, # Component that when clicked will open the lightbox (often a button)\n",
" href, # Href to image, youtube video, vimeo, google maps, etc.\n",
" data_alt=None, # Alt text for the lightbox item/image\n",
" data_caption=None, # Caption for the item that shows below it\n",
" cls='', # Class for the A tag (often nothing or `uk-btn`)\n",
" **kwargs # Additional args for the `A` tag\n",
" )->FT: # A(... href, data_alt, cls., ...)\n",
" \"Anchor tag with appropriate structure to go inside a `LightBoxContainer`\"\n",
" return fh.A(*c, href=href, data_alt=data_alt, cls=stringify(cls), **kwargs)"
```
Adding it to the return seems to fix it:
```python
" return fh.A(*c, href=href, data_alt=data_alt, data_caption=data_caption, cls=stringify(cls), **kwargs)"
```
## NavBar sticky top
The `top` value that's associated with the `sticky` functionality for the NavBar places it at `top-4`:
```python
# nbs/02_franken.ipynb:2339
" _sticky = 'float-left sticky top-4 hidden md:block' if sticky else ''\n",
```
This seems like it would not be the expected default behavior. Might be related to a difference in `box-sizing` settings? But I don't have any reset or css in addition to MonsterUI so I'm pretty sure I'm seeing it as it appears out of the box. So, anyway, I changed it to:
```python
# nbs/02_franken.ipynb:2339
" _sticky = 'float-left sticky top-0 hidden md:block' if sticky else ''\n",
```
I saw the same `top-4` value in the `NavContainer` component, but I haven't used that it so I'm not sure whether that's appropriate or not.
## Thanks
I can put in a PR if you'd like.
Contributor guide
Assessment
This issue has not been assessed yet.