diff --git a/public/app/core/routes/routes.ts b/public/app/core/routes/routes.ts index 71e21f19ae0..604dc9f9876 100644 --- a/public/app/core/routes/routes.ts +++ b/public/app/core/routes/routes.ts @@ -186,7 +186,7 @@ function setupAngularRoutes($routeProvider, $locationProvider) { .when('/global-alerts', { templateUrl: 'public/app/features/dashboard/partials/globalAlerts.html', }) - .when('/styleguide', { + .when('/styleguide/:page?', { controller: 'StyleGuideCtrl', controllerAs: 'ctrl', templateUrl: 'public/app/features/styleguide/styleguide.html', diff --git a/public/app/features/styleguide/styleguide.html b/public/app/features/styleguide/styleguide.html index 8695bcc0e91..fc0f4a4eba1 100644 --- a/public/app/features/styleguide/styleguide.html +++ b/public/app/features/styleguide/styleguide.html @@ -15,29 +15,34 @@ - - - - - + -
-
- -
+
+
    +
  • + ${{color.name}} + {{color.value}} +
  • +
+
+ +
+
+
+
+
+
- - - - +
+ forms +
diff --git a/public/app/features/styleguide/styleguide.ts b/public/app/features/styleguide/styleguide.ts index 31c0424ee6d..1a195c19ed2 100644 --- a/public/app/features/styleguide/styleguide.ts +++ b/public/app/features/styleguide/styleguide.ts @@ -9,12 +9,27 @@ class StyleGuideCtrl { buttonNames = ['primary', 'secondary', 'inverse', 'success', 'warning', 'danger']; buttonSizes = ['btn-small', '', 'btn-large']; buttonVariants = ['-', '-outline-']; + page: any; + pages = ['colors', 'buttons', 'forms', 'dashboard', 'query-editors']; /** @ngInject **/ - constructor($http) { + constructor(private $http, $routeParams) { this.theme = config.bootData.user.lightTheme ? 'light': 'dark'; + this.page = {}; - $http.get('public/sass/styleguide.json').then(res => { + if ($routeParams.page) { + this.page[$routeParams.page] = 1; + } else { + this.page.colors = true; + } + + if (this.page.colors) { + this.loadColors(); + } + } + + loadColors() { + this.$http.get('public/sass/styleguide.json').then(res => { this.colors = _.map(res.data[this.theme], (value, key) => { return {name: key, value: value}; }); @@ -23,7 +38,7 @@ class StyleGuideCtrl { switchTheme() { var other = this.theme === 'dark' ? 'light' : 'dark'; - window.location.href = config.appSubUrl + '/styleguide?theme=' + other; + window.location.href = window.location.href + '?theme=' + other; } } diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index d3ab196dd30..6a43c961c70 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -1,4 +1,4 @@ -$gf-form-margin: 0.4rem; +$gf-form-margin: 0.2rem; .gf-form { margin-bottom: $gf-form-margin;