Skip to content

Commit

Permalink
Migrate PageHeader component to React (#3324)
Browse files Browse the repository at this point in the history
* Migrate PageHeader component to React

* CR1
  • Loading branch information
kravets-levko authored and arikfr committed Jan 23, 2019
1 parent 1a61ee3 commit c2c722e
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 44 deletions.
2 changes: 1 addition & 1 deletion client/app/assets/less/redash/redash-newstyle.less
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ body {
padding: 20px;
}

page-header, .page-header--new {
.page-header-wrapper, .page-header--new {
h3 {
margin: 0.2em 0;
line-height: 1.3;
Expand Down
23 changes: 23 additions & 0 deletions client/app/components/PageHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';

export function PageHeader({ title }) {
return (
<div className="page-header-wrapper row p-l-15 p-r-15 m-b-10 m-l-0 m-r-0">
<div className="col-sm-9 p-l-0 p-r-0">
<h3>{ title }</h3>
</div>
</div>
);
}

PageHeader.propTypes = {
title: PropTypes.string.isRequired,
};

export default function init(ngModule) {
ngModule.component('pageHeader', react2angular(PageHeader));
}

init.init = true;
16 changes: 0 additions & 16 deletions client/app/components/page-header/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions client/app/components/page-header/page-header.html

This file was deleted.

3 changes: 1 addition & 2 deletions client/app/components/settings-screen.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container">
<page-header title="Settings">
</page-header>
<page-header title="'Settings'"></page-header>

<div class="bg-white tiled">
<ul class="tab-nav">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container">
<page-header title="Admin">
</page-header>
<page-header title="'Admin'"></page-header>

<div class="bg-white tiled">
<ul class="tab-nav">
Expand Down
5 changes: 2 additions & 3 deletions client/app/pages/admin/status/status.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container">
<page-header title="Admin">
</page-header>
<page-header title="'Admin'"></page-header>

<div class="bg-white tiled">
<ul class="tab-nav">
Expand Down Expand Up @@ -62,4 +61,4 @@
</ul>
</div>
</div>
</div>
</div>
3 changes: 1 addition & 2 deletions client/app/pages/admin/tasks/tasks.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container">
<page-header title="Admin">
</page-header>
<page-header title="'Admin'"></page-header>

<div class="bg-white tiled">
<ul class="tab-nav">
Expand Down
4 changes: 1 addition & 3 deletions client/app/pages/alert/alert.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="container">

<page-header title='{{$ctrl.alert.name || $ctrl.getDefaultName() || "New Alert" }}'>
</page-header>
<page-header title="$ctrl.alert.name || $ctrl.getDefaultName() || 'New Alert'"></page-header>

<email-settings-warning function="'alert emails'"></email-settings-warning>

Expand Down
2 changes: 1 addition & 1 deletion client/app/pages/alerts-list/alerts-list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="container">
<page-header title="Alerts"></page-header>
<page-header title="'Alerts'"></page-header>

<empty-state icon="fa fa-bell-o"
description="Get notified on certain events"
Expand Down
3 changes: 1 addition & 2 deletions client/app/pages/dashboards/dashboard-list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container">

<page-header title="Dashboards"></page-header>
<page-header title="'Dashboards'"></page-header>

<div class="row">
<div class="col-md-3 list-control-t">
Expand Down
3 changes: 1 addition & 2 deletions client/app/pages/dashboards/public-dashboard-page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div class="container p-t-10 p-b-20">
<page-header title="{{$ctrl.dashboard.name}}">
</page-header>
<page-header title="$ctrl.dashboard.name"></page-header>

<div class="m-b-5">
<filters ng-if="$ctrl.dashboard.dashboard_filters_enabled"></filters>
Expand Down
2 changes: 1 addition & 1 deletion client/app/pages/queries-list/queries-list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="container">
<page-header title="Queries"></page-header>
<page-header title="'Queries'"></page-header>

<div class="row">
<div class="col-md-3 list-control-t">
Expand Down

0 comments on commit c2c722e

Please sign in to comment.