Skip to content

Commit

Permalink
Add reusable feature-state component
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Ivange authored and Larry Ivange committed Jun 3, 2024
1 parent d0431ee commit 310706b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
32 changes: 31 additions & 1 deletion site/assets/scss/_styles_project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,34 @@ nav.foldable-nav .ul-1 .with-child>label:hover:before {

nav.foldable-nav .ul-1 .with-child>input:checked~label:hover:before {
transform: rotate(90deg) !important;
}
}

div.feature-state-notice {
background-color: #daeaf9;
border-radius: 0.75rem;
padding: 1rem;
margin-bottom: 1em;

font-size: 1.2em;

> .feature-state-name::before {
content: '';
color: #326ce5; // Kubernetes blue
}
> .feature-state-name {
display: inline-block;
font-size: 0.95em;
font-weight: bold;
color: #000;
background-color: #daeaf9;
}

code {
color: #000;
font-size: 1em;
background-color: #daeaf9;
}

margin-right: 2em;
max-width: 80%;
}
14 changes: 14 additions & 0 deletions site/layouts/shortcodes/feature-state.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

{{ $valid_states := "alpha, beta, deprecated, stable" }}
{{ $state := .Get "state" }}
{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version")}}
{{ $is_valid := strings.Contains $valid_states $state }}

{{ if not $is_valid }}
{{ errorf "%q is not a valid feature-state, use one of %q" $state $valid_states }}
{{ else }}
<div class="feature-state-notice feature-{{ $state }}">
<span class="feature-state-name">FEATURE STATE</span> <code>Kubernetes {{ $for_k8s_version }} [{{ $state }}]</code>
</div>
{{ end }}

0 comments on commit 310706b

Please sign in to comment.