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

add global version callout component #6673

Merged
merged 15 commits into from
Dec 23, 2024
Merged

add global version callout component #6673

merged 15 commits into from
Dec 23, 2024

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Dec 16, 2024

this pr adds a global VersionCallout componnent allowing the docs team to use a component to make it easier to standardize using version callouts on the docs site.

for example, we can use <VersionCallout version="2.5" /> (in this example, version 2.5 is fictional) and that will dispaly a tip callout saying:
Screenshot 2024-12-16 at 11 43 20

docs project


🚀 Deployment available! Here are the direct links to the updated files:

@mirnawong1 mirnawong1 requested a review from a team as a code owner December 16, 2024 11:54
Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview Dec 23, 2024 9:24am

@github-actions github-actions bot added content Improvements or additions to content size: small This change will take 1 to 2 days to address Docs team Authored by the Docs team @dbt Labs labels Dec 16, 2024
@@ -0,0 +1,8 @@

:::info Model versions, dbt_project.yml versions, and .yml versions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed this callout from 'version-callout' to the more appropriate 'model-version-callout'.

Copy link
Collaborator

@runleonarun runleonarun left a comment

Choose a reason for hiding this comment

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

This looks great! 🚢 it!

@mirnawong1
Copy link
Contributor Author

Asana request for web team review: https://app.asana.com/0/1200099998847559/1209022948285146/f

Copy link
Collaborator

@JKarlavige JKarlavige left a comment

Choose a reason for hiding this comment

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

Great work @mirnawong1, this lgtm! Added one comment with a small area of improvement within the component if you'd like to add it, but all functionality looks to work as expected here! :shipit:

Comment on lines 4 to 15
const VersionCallout = ({ version }) => (
<div>
<Admonition type="tip" icon="💡" title="Did you know...">
<span>
Available from dbt v{version} or with the{' '}
<a href="/docs/dbt-versions/cloud-release-tracks">
dbt Cloud "Latest" release track
</a>{' '}.
</span>
</Admonition>
</div>
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice work with this! One small opportunity for improvement here would be to add an if check if the version prop has been passed in before applying the code to the page. For example if <VersionCallout /> is added to a page without a version, it will still show the callout without a version.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh damn that's such a good flag! Thank you @JKarlavige !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks again @JKarlavige ! added a

if (!version) {
    return null;
  }

to the const VersionCallout statement and it worked! nothing is displayed if i forget to add the version. thank you again for that awesome tip!

@mirnawong1 mirnawong1 enabled auto-merge December 23, 2024 09:21
@mirnawong1 mirnawong1 merged commit 702651b into current Dec 23, 2024
8 checks passed
@mirnawong1 mirnawong1 deleted the add-version-snippet branch December 23, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants