1
0
mirror of https://github.com/actix/actix-website synced 2024-11-30 11:12:57 +01:00

Added feature box

This commit is contained in:
Armin Ronacher 2018-05-23 23:47:00 +02:00
parent 8246cf132b
commit 2f9245e580
4 changed files with 66 additions and 12 deletions

View File

@ -59,10 +59,9 @@ fn main() {
</div> </div>
</div> </div>
</div> </div>
<div class="row actix-showcase"> <div class="actix-showcase">
<div class="col-md-8"> <div class="col-md-9">
<input type="radio" name="feature" id="responders" checked> <div class="actix-feature" id="responders">
<div class="feature">
<h2>Flexible Responders</h2> <h2>Flexible Responders</h2>
<p> <p>
Handler functions in actix can return a wide range of objects that Handler functions in actix can return a wide range of objects that
@ -82,8 +81,7 @@ fn current_temperature(_req: HttpRequest) -> impl Responder {
Json(Measurement { temperature: 42.3 }) Json(Measurement { temperature: 42.3 })
}` "rust" "" }} }` "rust" "" }}
</div> </div>
<input type="radio" name="feature" id="extractors"> <div class="actix-feature" id="extractors">
<div class="feature">
<h2>Powerful Extractors</h2> <h2>Powerful Extractors</h2>
<p> <p>
Actix comes with a powerful extractor system that extracts data Actix comes with a powerful extractor system that extracts data
@ -104,8 +102,7 @@ fn capture_event(evt: Json<Event>) -> impl Responder {
format!("got event {}", id) format!("got event {}", id)
}` "rust" "" }} }` "rust" "" }}
</div> </div>
<input type="radio" name="feature" id="forms"> <div class="actix-feature" id="forms">
<div class="feature">
<h2>Easy Form Handling</h2> <h2>Easy Form Handling</h2>
<p> <p>
Handling multipart/urlencoded form data is easy. Just define Handling multipart/urlencoded form data is easy. Just define
@ -123,10 +120,12 @@ fn register(data: Form<Register>) -> impl Responder {
}` "rust" "" }} }` "rust" "" }}
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-3 actix-feature-selectors">
<label for="responders">flexible responders</label> <ul>
<label for="extractors">powerful extractors</label> <li class="actix-feature-selector"><a href="#responders">flexible responders</label>
<label for="forms">easy form handling</label> <li class="actix-feature-selector"><a href="#extractors">powerful extractors</label>
<li class="actix-feature-selector"><a href="#forms">easy form handling</label>
</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -13,6 +13,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
<script src="/js/bootstrap.min.js"></script> <script src="/js/bootstrap.min.js"></script>
<script src="/js/actix.js"></script>
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
</body> </body>
</html> </html>

View File

@ -283,8 +283,11 @@ img {
} }
.actix-showcase { .actix-showcase {
overflow: hidden;
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 2rem; margin-bottom: 2rem;
padding: 2rem 1rem 0 1rem;
background: #dceaea;
} }
.actix-showcase ul { .actix-showcase ul {
@ -332,6 +335,25 @@ img {
font-size: 1rem; font-size: 1rem;
} }
.actix-feature-selectors {
padding-bottom: 2rem;
}
.actix-feature-selector {
text-align: center;
padding: 0.5rem 1rem;
font-weight: bold;
}
.actix-feature-selector.active {
background: white;
}
.actix-feature-selector.active a {
color: #333!important;
text-decoration: none;
}
.final-pitch { .final-pitch {
text-align: center; text-align: center;
} }

View File

@ -0,0 +1,32 @@
(function() {
function activateFeature(sel) {
$('div.actix-feature').hide();
$(sel).show();
$('li.actix-feature-selector').removeClass('active');
$('li.actix-feature-selector > a').each(function() {
if (this.getAttribute('href') === sel) {
$(this).parent().addClass('active');
}
});
}
function initFeatureSelector() {
$('div.actix-feature').hide();
var active = $(window.location.hash);
if (active.is('div.actix-feature')) {
activateFeature(window.location.hash);
} else {
activateFeature('#' + $('div.actix-feature')[0].id);
}
$('ul li.actix-feature-selector a').on('click', function(evt) {
evt.preventDefault();
history.replaceState({}, '', evt.target.href);
activateFeature(this.getAttribute('href'));
});
}
$(function() {
initFeatureSelector();
});
})();