Skip to content

LightboxItem Caption not passed to element & NavBar Sticky "top" #137

@germyparker

Description

@germyparker

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:

# 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:

# 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:

    "    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:

# 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:

# 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions