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

Update to search description #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ofermend
Copy link
Collaborator

Making the "search_description" be a Markdown component to support a need in one demo to include LINK in that description.

<h2 style={{ whiteSpace: "pre-line" }}>
{searchHeader.description.replaceAll("\\n", "\n")}
</h2>
<Markdown
Copy link
Collaborator

@cjcenizal cjcenizal Jan 10, 2024

Choose a reason for hiding this comment

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

Markdown will enable elements here that don't belong, such as lists, tables, and multiple paragraphs. This seems like overkill for the stated problem.

I think a more targeted solution would be to add a searchHeader.descriptionUrl option. Then this code would conditionally render a link if that option is defined. What do you think of this approach?

const searchHeaderDescription = searchHeader.description.replaceAll("\\n", "\n");

const searchHeaderContent = searchHeader.descriptionUrl ? (
  <a href={searchHeader.descriptionUrl}>{searchHeaderDescription}</a>
) : searchHeaderDescription;

return (
  <VuiTextColor color="subdued">
    <h2 style={{ whiteSpace: "pre-line" }}>
      {searchHeaderContent}
    </h2>
  </VuiTextColor>
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So in this way the whole description is a single URL right?
In this case, the idea was to have something like "Created by Bob Gourley (OODA)" where only OODA is a URL linking to Bob's website. Any good way to do that?
I think Markdown can also be useful to do multi-line descriptions that we want to control the line breaks e.g. with

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'd probably make the whole thing a link or I'd add a location in the UI for rendering some kind of authorship link. I'll approve this PR to unblock you though.

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.

2 participants