From 79678332549e3343c53fb585e670f600f3f00503 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 17 Jul 2016 19:44:36 +0300 Subject: [PATCH] Minor rendering perf improvements --- .../RequestSamples/request-samples.html | 2 +- .../RequestSamples/request-samples.scss | 4 ++++ .../ResponsesSamples/responses-samples.scss | 4 ++++ lib/components/SchemaSample/schema-sample.scss | 17 ++++++++++++----- lib/components/SchemaSample/schema-sample.ts | 6 +++++- package.json | 2 +- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html index 05715ba8..1bbc5ca2 100644 --- a/lib/components/RequestSamples/request-samples.html +++ b/lib/components/RequestSamples/request-samples.html @@ -7,7 +7,7 @@
- Copy + Copy

     
diff --git a/lib/components/RequestSamples/request-samples.scss b/lib/components/RequestSamples/request-samples.scss index 60c3fc5a..de7e3479 100644 --- a/lib/components/RequestSamples/request-samples.scss +++ b/lib/components/RequestSamples/request-samples.scss @@ -1,5 +1,9 @@ @import '../../shared/styles/variables'; +:host { + overflow: hidden; +} + .action-buttons { display: block; opacity: 0; diff --git a/lib/components/ResponsesSamples/responses-samples.scss b/lib/components/ResponsesSamples/responses-samples.scss index 1334dd8d..75f344e0 100644 --- a/lib/components/ResponsesSamples/responses-samples.scss +++ b/lib/components/ResponsesSamples/responses-samples.scss @@ -1,5 +1,9 @@ @import '../../shared/styles/variables'; +:host { + overflow: hidden; +} + tab, tabs { display: block; } diff --git a/lib/components/SchemaSample/schema-sample.scss b/lib/components/SchemaSample/schema-sample.scss index c0480079..1d0f47cc 100644 --- a/lib/components/SchemaSample/schema-sample.scss +++ b/lib/components/SchemaSample/schema-sample.scss @@ -5,6 +5,12 @@ pre { padding: 0; margin: 0; clear: both; + position: relative; +} + +// hide top-level collapser +.redoc-json > .collapser { + display: none; } .action-buttons { @@ -12,9 +18,15 @@ pre { opacity: 0; transition: opacity 0.3s ease; transform: translateY(100%); + z-index: 1; + position: relative; > span { float: right; + + &:last-child > a:before { + display: none; + } } > span > a { @@ -28,11 +40,6 @@ pre { transform: translateX(-10px); } - &:last-child:before { - display: none; - margin-left: 0; - } - &:first-child { margin-right: 0; } diff --git a/lib/components/SchemaSample/schema-sample.ts b/lib/components/SchemaSample/schema-sample.ts index 86abd1b2..b63cd5a9 100644 --- a/lib/components/SchemaSample/schema-sample.ts +++ b/lib/components/SchemaSample/schema-sample.ts @@ -63,6 +63,7 @@ export class SchemaSample extends BaseComponent { } } if (this.fromCache()) { + this.initButtons(); return; } try { @@ -78,8 +79,11 @@ export class SchemaSample extends BaseComponent { } this.cache(sample); this.data.sample = sample; + this.initButtons(); + } - if (typeof sample === 'object') { + initButtons() { + if (typeof this.data.sample === 'object') { this.enableButtons = true; } } diff --git a/package.json b/package.json index 7fe16147..8c490574 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "0.16.0", + "version": "0.16.1", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc"