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

DOP-4623: [Dark mode updates] Cards component + card icon as string #601

Merged
merged 10 commits into from
Jun 10, 2024

Conversation

mayaraman19
Copy link
Collaborator

@mayaraman19 mayaraman19 commented Jun 5, 2024

Ticket

DOP-4623

Notes

Ugh, there's a lot going on in my brain for this but hopefully I get everything.

  • in addition to Snooty's changes, this adds support for getting card icons from their names in the list here rather than having to store them in the content repo. This makes it easier to get images in their dark mode version, since we don't have to store both versions and can instead access them via a URL.
  • If, however, we can't access the necessary image from the above list, the icon-dark option has been added to cards, as well as a warning if icon comes from an image stored in the content repo but icon-dark is not given.
  • Also, deleted the unused BaseCardGroupDirective, CardDefinition, and CardGroupDefinition classes 🎉

Example parser output now looks like this (for the docs-compass PR linked in the Snooty PR):
image

Relevant Snooty PR here.

Some future work here can involve:

  • creating a list of acceptable icons in the parser so we can validate them as they're being written in rST

README updates

    • This PR introduces changes that should be reflected in the README.md and/or HACKING.md, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README.md and/or HACKING.md

@mayaraman19 mayaraman19 changed the title Dop 4623 DOP-4623: [Dark mode updates] Cards component + card icon as string Jun 5, 2024
@mayaraman19 mayaraman19 marked this pull request as ready for review June 6, 2024 13:14
@@ -118,32 +118,6 @@ class LegacyTabsDefinition(nodes.Node):
tabs: List[LegacyTabDefinition]


@checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this removal brings me great joy!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, pretty red :)

end: Union[None, int, Tuple[int, int]] = None,
) -> None:
super().__init__(
f"""Card icons are migrating to strings instead of path names. If {image_argument} can be a string, use that instead.""",
Copy link
Collaborator

@rayangler rayangler Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Non-blocking, but maybe worth discussing) Would it be worth including more information on what the "string" is supposed to be or how to know what the string is supposed to be?

Also, I know that we have a strategy for handling marketing's icons through the web assets URL, but do we have a strategy for other icons like for drivers/languages/integrations? If we don't currently support all existing icons by using strings, I'm afraid of causing noise and confusion through this warning for card icons that can't immediately be updated. Should we consider adding this warning at a later time once we fully support everything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds good!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am wondering if the warning that a dark mode icon hasn't been included should be silenced until we are closer to releasing dark mode?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm okay with waiting if we need the time to sort out all of the dark mode icons for cards

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the warning!

snooty/parser.py Outdated Show resolved Hide resolved
@@ -118,32 +118,6 @@ class LegacyTabsDefinition(nodes.Node):
tabs: List[LegacyTabDefinition]


@checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, pretty red :)

snooty/parser.py Outdated
# for cards - if the image is a path, we need a dark mode version as well
if key == "mongodb:card":
if image_argument and "/" in image_argument:
self.diagnostics.append(CardIconString(image_argument, line))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to @rayangler s comment above but wouldn't this PR still have a warning ?

think we should allow name and path, but require a icon-dark if its a path

snooty/parser.py Outdated
dark_mode_image_argument = options.get("icon-dark")
if dark_mode_image_argument:
self.validate_and_add_asset(doc, dark_mode_image_argument, line)
else:
Copy link
Collaborator

@i80and i80and Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Collapse this into a single elif image_argument:

@mayaraman19 mayaraman19 requested a review from i80and June 10, 2024 20:48
@mayaraman19 mayaraman19 merged commit 15f55b7 into main Jun 10, 2024
5 checks passed
@mayaraman19 mayaraman19 deleted the DOP-4623 branch June 10, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants