Skip to content

Commit 79d53da

Browse files
authored
Improve styling of the example/s graphics API callout (#1918)
1 parent 297591d commit 79d53da

File tree

7 files changed

+34
-18
lines changed

7 files changed

+34
-18
lines changed

sass/components/_callout.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.callout {
22
margin-block: 32px;
3-
padding: 16px;
3+
padding: 12px 16px;
44
border-radius: 4px;
55
background-color: var(--callout-bg-color);
66
border-top: 4px solid var(--callout-accent-color);
@@ -14,6 +14,10 @@
1414
margin-bottom: 0;
1515
}
1616

17+
&--plain {
18+
border-top: 0;
19+
}
20+
1721
&,
1822
&--info {
1923
--callout-accent-color: #5944e0;

sass/components/_example.scss

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
&__header {
55
display: grid;
66
gap: 8px;
7-
margin: 16px 0 8px;
7+
margin: 16px 0 16px;
88
align-items: baseline;
99
grid-template-columns: 1fr 1fr;
1010
grid-template-areas:
1111
"title title"
12-
"back github"
13-
;
12+
"back github";
1413

1514
@media #{$bp-tablet-portrait-up} {
16-
margin: 24px 0 8px;
15+
margin: 32px 0 16px;
1716
grid-template-areas: "back title github";
1817
grid-template-columns: 150px 1fr 150px;
1918
}
@@ -51,4 +50,10 @@
5150
&__code-tabs {
5251
margin-top: 16px;
5352
}
53+
54+
&__callout {
55+
margin-top: 2px;
56+
margin-block: 4px 16px !important;
57+
font-size: 1rem !important;
58+
}
5459
}

templates/example-webgpu.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
{% block examples_url %}/examples-webgpu{% endblock examples_url %}
44
{% block wasm_base_url %}https://bevy-webgpu-examples.pages.dev{% endblock wasm_base_url %}
5-
{% block intro %}
6-
<h2 class="warning">Support Warning</h2>
5+
{% block callout_modifier %}warning{% endblock callout_modifier %}
6+
{% block callout %}
7+
<strong>Support Warning.</strong>
78
WebGPU is currently only supported on Chrome starting with version 113, and only on desktop.
8-
If they don't work on your configuration, you can check the WebGL2 examples <a href="/examples">here</a>.
9+
If the example doesn't work on your configuration, you can check the WebGL2 example <a href="{{ page.path | replace(from="/examples-webgpu/", to="/examples/") }}">here</a>.
910
{% endblock intro %}

templates/example.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
{% block examples_url %}/examples{% endblock examples_url %}
44
{% block wasm_base_url %}https://bevy-webgl2-examples.pages.dev{% endblock wasm_base_url %}
5-
{% block intro %}
5+
{% block callout_modifier %}info{% endblock callout_modifier %}
6+
{% block callout %}
67
This example is running in WebGL2 and should work in most browsers.
7-
You can check the WebGPU examples <a href="/examples-webgpu">here</a>.
8+
You can check the WebGPU example <a href="{{ page.path | replace(from="/examples/", to="/examples-webgpu/") }}">here</a>.
89
{% endblock intro %}

templates/examples-webgpu.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
These examples demonstrate how to use Bevy's features in a minimal, easy to understand way.
55
Click an example below to run it in your browser (using WASM + WebGPU) and view the source code.
66
You can also view these examples (and others) in the <a href="https://github.com/bevyengine/bevy/tree/main/examples#examples">Bevy repo</a>.
7-
<h2 class="warning">Support Warning</h2>
8-
WebGPU is currently only supported on Chrome starting with version 113, and only on desktop.
9-
If they don't work on your configuration, you can check the WebGL2 examples <a href="/examples">here</a>.
7+
<aside class="callout callout--warning">
8+
<h3 class="warning">Support Warning</h3>
9+
<p>
10+
WebGPU is currently only supported on Chrome starting with version 113, and only on desktop.
11+
If they don't work on your configuration, you can check the WebGL2 examples <a href="/examples">here</a>.
12+
</p>
13+
</aside>
1014
{% endblock intro %}

templates/examples.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
These examples demonstrate how to use Bevy's features in a minimal, easy to understand way.
55
Click an example below to run it in your browser (using WASM + WebGL) and view the source code.
66
You can also view these examples (and others) in the <a href="https://github.com/bevyengine/bevy/tree/latest/examples#examples">Bevy repo</a>.
7-
<p>If you would like to try WASM + WebGPU, you can explore our <a href="/examples-webgpu">live WebGPU examples</a> page.</p>
7+
<aside class="callout callout--info">
8+
<p>If you would like to try WASM + WebGPU, you can explore our <a href="/examples-webgpu">live WebGPU examples</a> page.</p>
9+
</aside>
810
{% endblock intro %}

templates/layouts/example.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ <h2 class="example__title">{{ category.title }} / {{ page.title }}</h2>
1212
<i class="icon icon--github"></i> View in GitHub
1313
</a>
1414
</div>
15-
<div class="assets-intro media-content">
16-
{% block intro %}{% endblock intro %}
17-
</div>
18-
<br />
1915
<div class="example__canvas bevy-instance">
2016
<div class="bevy-instance__progress-status" data-progress-status>
2117
<div class="bevy-instance__progress-file" data-progress-file></div>
@@ -24,6 +20,9 @@ <h2 class="example__title">{{ category.title }} / {{ page.title }}</h2>
2420
</div>
2521
</div>
2622
<canvas class="bevy-instance__canvas" id="bevy" width="1280" height="720"></canvas>
23+
<aside class="example__callout media-content callout callout--plain callout--{% block callout_modifier %}{% endblock callout_modifier %}">
24+
{% block callout %}{% endblock callout %}
25+
</aside>
2726
</div>
2827

2928
<div class="example__code-tabs tabs">

0 commit comments

Comments
 (0)