Skip to content

Commit

Permalink
updated style, changed rendering to load from path
Browse files Browse the repository at this point in the history
Signed-off-by: lior sventitzky <[email protected]>
  • Loading branch information
liorsve committed Jan 9, 2025
1 parent 020fa88 commit 8e69fbc
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 52 deletions.
170 changes: 132 additions & 38 deletions sass/_valkey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -698,48 +698,142 @@ pre table {
border-top: 1px solid $grey-dk-100;
}

.table-container {
padding: 10px;
background-color: #fafafa;
border: 1px solid #ddd;
border-radius: 8px;
overflow-x: auto;
}

.table-header {
background-color: #f4f4f4;
text-align: center;
font-weight: bold;
border-bottom: 2px #ccc;
}
.client-list {
h2 {
margin-top: 2rem;
margin-bottom: 1rem;

.table-header-cell {
padding: 10px;
border-right: 1px solid #e0e0e0;
text-align: center;
color: #555;
}
}

.table-row {
&.even-row {
background-color: #fbfbfb;
ul {
list-style-type: circle;
padding-left: 1.5rem;
}
&.odd-row {
background-color: #ffffff;

.language-clients {
margin-bottom: 3rem;

.client-item {
margin-bottom: 2rem;
padding: 1rem;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #fff;

h3 {
margin-top: 0;
color: #222;
}

ul {
list-style-type: none;
padding-left: 0;

> li {
position: relative;
padding-left: 1.5em;

&::before {
content: "\2022";
position: absolute;
left: 0.5em;
color: #000;
}

> ul > li {
padding-left: 1.5em;

&::before {
content: "\25E6";
position: absolute;
left: 0.5em;
color: #000;
}
}
}
}

code, pre {
background-color: #f5f5f5;
padding: 0.2rem 0.4rem;
border-radius: 3px;
}

pre {
padding: 1rem;
overflow-x: auto;
background-color: #f5f5f5;
border-radius: 3px;
}
}
}
}

.table-cell {
padding: 8px 12px;
border-right: 1px solid #eee;
text-align: center;
color: #444;
white-space: normal;
word-wrap: break-word;
}
.feature-comparison-table {
margin-top: 3rem;

.table-cell:first-child {
font-weight: bold;
text-align: center;
color: #555;
}
.table-container {
padding: 0;
background-color: #fafafa;
border: 1px solid #ddd;
border-radius: 8px;
overflow-x: auto;

table {
width: 100%;
border-collapse: collapse;
th, td {
padding: 8px 12px;
text-align: center;
border-right: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}

th:first-child,
td:first-child {
position: sticky;
left: 0;
background-color: #fafafa;
z-index: 2;
}
}

.table-header {
background-color: #f4f4f4;
font-weight: bold;

.table-header-cell {
padding: 10px;
color: #555;
position: sticky;
top: 0;
z-index: 1;
background-color: #f4f4f4;
}

.table-header-cell:first-child {
z-index: 3;
}
}

.table-row {
&.even-row {
background-color: #f9f9f9;
}
&.odd-row {
background-color: #fff;
}

.table-cell {
color: #444;
white-space: normal;
word-wrap: break-word;

&:first-child {
font-weight: bold;
color: #555;
}
}
}
}
}
10 changes: 5 additions & 5 deletions templates/client-feature-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ <h2 >Feature Comparison Table</h2>
<table >
<thead>
<tr class="table-header">
{% for header in ["Client Name", "Language", "Valkey Version Compliance","Package Size", "Read From Replica", "Smart Backoff to Prevent Connection Storm", "PubSub State Restoration", "Cluster Scan", "Latency-Based Read From Replica", "AZ-Based Read From Replica", "Client Side Caching", "CLIENT CAPA Redirect", "Persistent Connection Pool"] %}
<th class="table-header-cell">{{ header }}</th>
{% for header in client_fields %}
<th class="table-header-cell">{{ header | replace(from="_", to=" ") | title | replace (from= "Az", to= "AZ") }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{%- for path in client_paths %}
{% set json_data = load_data(path = docs::client_json_path(client_path= path), format="json") %}
<tr class="table-row {% if loop.index is even %}even-row{% else %}odd-row{% endif %}">
{% for field in ["name", "language", "valkey_version_compliance","package_size", "read_from_replica", "smart_backoff_to_prevent_connection_storm", "pubsub_state_restoration", "cluster_scan", "latency_based_read_from_replica", "AZ_based_read_from_replica", "client_side_caching", "client_capa_redirect", "persistent_connection_pool"] %}
{% for field in client_fields %}
<td class="table-cell">
{% if field not in ["name", "language", "valkey_version_compliance", "package_size"] %}
{{ docs::boolean_to_yes_no(value=json_data[field]) }}
{% if field not in ["name", "language", "package_size"] %}
{{ docs::boolean_to_checkmark(value=json_data[field]) }}
{% else %}
{{ json_data[field] }}
{% endif %}
Expand Down
19 changes: 13 additions & 6 deletions templates/client-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ <h1 class="page-title">Documentation: Clients</h1>

<div class="client-list">
<h2>Table of Contents</h2>
<ul>
{% set languages = ["Python", "JavaScript/Node.js", "Java", "Go", "PHP"] %}
<ul>
{% set languages = [] %}
{% for path in section.extra.recommended_clients_paths %}
{% set language = path | split(pat="/") | nth(n=1) %}
{% if language not in languages %}
{% set_global languages = languages | concat(with=language) %}
{% endif %}
{% endfor %}
{% for language in languages %}
<li><a href="#{{ language | slugify }}">{{ language }}</a></li>
<li><a href="#{{ language | slugify }}">{{ language | title }}</a></li>
{% endfor %}
<li><a href="#feature-comparison-table">Feature Comparison Table</a></li>
</ul>
{% for language in languages %}
<h2 id="{{ language | slugify }}">{{ language }}</h2>
<div class="language-clients">
<h2 id="{{ language | slugify }}">{{ language | title }}</h2>
{% for path in section.extra.recommended_clients_paths %}
{% set client = load_data(path = docs::client_json_path(client_path= path), format="json") %}
{% if client.language == language %}
<div class="client-item">
<h3>{{ client.name }}</h3>
<div class="client-item" >
<h3 id="{{ client.name | slugify }}">{{ client.name }}</h3>
<ul>
<li><strong>GitHub:</strong> <a href="{{ client.github }}">{{ client.name }}</a></li>
<li>
Expand Down Expand Up @@ -67,6 +73,7 @@ <h3>{{ client.name }}</h3>
</div>
<div id="feature-comparison-table" class = "feature-comparison-table" >
{% set client_paths = section.extra.recommended_clients_paths %}
{% set client_fields = section.extra.client_fields %}
{% include "client-feature-table.html" %}
</div>
{% endblock main_content %}
6 changes: 3 additions & 3 deletions templates/macros/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
{%- endmacro client_json_path -%}


{%- macro boolean_to_yes_no(value) -%}
{%- macro boolean_to_checkmark(value) -%}
{% if value == true %}
Yes
{% else %}
No
{% endif %}
{%- endmacro %}

0 comments on commit 8e69fbc

Please sign in to comment.