-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate UI Framework source into Kibana. #9192
Changes from 1 commit
de3f34f
4e54844
43854bc
fe5bab1
a44140a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ selenium | |
*.swp | ||
*.swo | ||
*.out | ||
src/ui_framework/public/*.js* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,8 @@ | |
"makelogs": "makelogs", | ||
"mocha": "mocha", | ||
"mocha:debug": "mocha --debug-brk", | ||
"sterilize": "grunt sterilize" | ||
"sterilize": "grunt sterilize", | ||
"uiFramework:start": "./node_modules/.bin/webpack-dev-server --config src/ui_framework/webpack.config.js --hot --inline --content-base src/ui_framework/public/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -171,6 +172,8 @@ | |
"cheerio": "0.22.0", | ||
"chokidar": "1.6.0", | ||
"chromedriver": "2.24.1", | ||
"classnames": "2.2.5", | ||
"del": "1.2.1", | ||
"elasticdump": "2.1.1", | ||
"eslint": "1.10.3", | ||
"eslint-plugin-mocha": "1.1.0", | ||
|
@@ -190,6 +193,9 @@ | |
"gruntify-eslint": "1.0.1", | ||
"gulp-sourcemaps": "1.7.3", | ||
"handlebars": "4.0.5", | ||
"highlight.js": "9.0.0", | ||
"history": "2.1.1", | ||
"html-loader": "0.4.3", | ||
"husky": "0.8.1", | ||
"image-diff": "1.6.0", | ||
"intern": "3.2.3", | ||
|
@@ -201,6 +207,7 @@ | |
"karma-ie-launcher": "0.2.0", | ||
"karma-mocha": "0.2.0", | ||
"karma-safari-launcher": "0.1.1", | ||
"keymirror": "0.1.1", | ||
"license-checker": "5.1.2", | ||
"load-grunt-config": "0.19.2", | ||
"makelogs": "3.0.2", | ||
|
@@ -209,15 +216,27 @@ | |
"murmurhash3js": "3.0.1", | ||
"ncp": "2.0.0", | ||
"nock": "8.0.0", | ||
"node-sass": "3.8.0", | ||
"npm": "3.10.8", | ||
"numeral": "1.5.3", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think numeral has caused us some issues in the past, though I suspect your use is probably fine. Curious what you're using it for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I don't think it's actually being used anywhere. Thanks for catching this, I'll remove it. |
||
"portscanner": "1.0.0", | ||
"proxyquire": "1.7.10", | ||
"react": "15.2.0", | ||
"react-addons-test-utils": "15.2.0", | ||
"react-dom": "15.2.0", | ||
"react-redux": "4.4.5", | ||
"react-router": "2.0.0", | ||
"react-router-redux": "4.0.4", | ||
"redux": "3.0.0", | ||
"redux-thunk": "0.1.0", | ||
"sass-loader": "4.0.0", | ||
"simple-git": "1.37.0", | ||
"sinon": "1.17.2", | ||
"source-map": "0.5.6", | ||
"source-map-support": "0.2.10", | ||
"supertest": "1.2.0", | ||
"supertest-as-promised": "2.0.2" | ||
"supertest-as-promised": "2.0.2", | ||
"webpack-dev-server": "1.14.1" | ||
}, | ||
"engines": { | ||
"node": "6.9.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,10 @@ class BaseOptimizer { | |
`css${mapQ}!autoprefixer${mapQPre}{ "browsers": ["last 2 versions","> 5%"] }!less${mapQPre}dumpLineNumbers=comments` | ||
) | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
loaders: ['style', 'css', 'sass'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably should be using the {
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
'style',
`css${mapQ}!autoprefixer${mapQPre}{ "browsers": ["last 2 versions","> 5%"] }!sass${mapQPre}`
)
} |
||
}, | ||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', `css${mapQ}`) }, | ||
{ test: /\.jade$/, loader: 'jade' }, | ||
{ test: /\.json$/, loader: 'json' }, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
// Kibana UI Framework | ||
require('../../../ui_framework/src/framework/framework.scss'); | ||
|
||
// All Kibana styles inside of the /styles dir | ||
const context = require.context('../styles', false, /[\/\\](?!mixins|variables|_|\.)[^\/\\]+\.less/); | ||
context.keys().forEach(key => context(key)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Kibana UI Framework | ||
|
||
## Development | ||
|
||
* Start development server `npm run uiFramework:start`. | ||
* View docs on `http://localhost:8080/`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8080 is a common, and the default port for webpack dev server. We will probably want to change this in the future to avoid collisions. |
||
|
||
## What is this? | ||
|
||
The UI Framework provides you with UI components you can quickly use to build UIs, as well as interactive examples which document how they're supposed to be used. These UI components are currently only implemented in CSS and markup, but eventually they'll grow to involve JS as well. | ||
|
||
When you build a UI using this framework (e.g. a plugin's UI), you can rest assured it will fit into the overall Kibana UI. | ||
|
||
## Benefits | ||
|
||
### Dynamic, interactive documentation | ||
|
||
By having a "living style guide", we relieve our designers of the burden of creating and maintaining static style guides. This also makes it easier for our engineers to translate mockups, prototypes, and wireframes into products. | ||
|
||
### Copy-pasteable UI | ||
|
||
Engineers can copy and paste sample code into their projects to quickly get reliable, consistent results. | ||
|
||
### Remove CSS from the day-to-day | ||
|
||
The CSS portion of this framework means engineers don't need to spend mental cycles. These cycles can be spent on the things critical to the identity of the specific project they're working on, like architecture and business logic. | ||
|
||
Once this framework also provides JS components, engineers won't even need to _see_ CSS -- it will be encapsulated behind the JS components' interfaces. | ||
|
||
### More UI tests === fewer UI bugs | ||
|
||
By covering our UI components with great unit tests and having those tests live within the framework itself, we can rest assured that our UI layer is tested and remove some of that burden from out integration/end-to-end tests. | ||
|
||
## Why not just use Bootstrap? | ||
|
||
In short: we've outgrown it! Third-party CSS frameworks like Bootstrap and Foundation are designed | ||
for a general audience, so they offer things we don't need and _don't_ offer things we _do_ need. | ||
As a result, we've forced to override their styles until the original framework is no longer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
recognizable. When the CSS reaches that point, it's time to take ownership over it and build | ||
your own framework. | ||
|
||
We also gain the ability to fix some of the common issues with third-party CSS frameworks: | ||
|
||
* They have non-semantic markup. | ||
* They deeply nest their selectors. | ||
|
||
For a more in-depth analysis of the problems with Bootstrap (and similar frameworks), check out this article and the links it has at the bottom: ["Bootstrap Bankruptcy"](http://www.matthewcopeland.me/blog/2013/11/04/bootstrap-bankruptcy/). | ||
|
||
## Examples of other in-house UI frameworks | ||
|
||
* [Ubiquiti CSS Framework](http://ubnt-css.herokuapp.com/#/app/popover) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't you make this? 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure did! |
||
* [Smaato React UI Framework](http://smaato.github.io/ui-framework/#/modal) | ||
* [Lonely Planet Style Guide](http://rizzo.lonelyplanet.com/styleguide/design-elements/colours) | ||
* [MailChimp Patterns Library](http://ux.mailchimp.com/patterns) | ||
* [Salesforce Lightning Design System](https://www.lightningdesignsystem.com/) | ||
* [Refills](http://refills.bourbon.io/) | ||
* [Formstone](https://formstone.it/) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF8"> | ||
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700|Ubuntu+Mono:400' rel='stylesheet' type='text/css'> | ||
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"> | ||
<script src="https://use.fontawesome.com/a9649923ac.js"></script> | ||
</head> | ||
<body> | ||
<div id="guide" style="height: 100%"></div> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Normal colors | ||
$localNavTextColor: $textColor; | ||
$localNavBackgroundColor: #e4e4e4; | ||
$localNavButtonTextColor: #5a5a5a; | ||
$localNavButtonTextColor-isHover: #000000; | ||
$localNavButtonBackgroundColor: transparent; | ||
$localNavButtonBackgroundColor-isHover: rgba(#000000, 0.1); | ||
$localNavButtonBackgroundColor-isSelected: #f6f6f6; | ||
$localNavBreadcrumbDelimiterColor: #5a5a5a; | ||
$localSearchBackgroundColor: #ffffff; | ||
$localSearchBorderColor-isInvalid: #e74C3c; | ||
$localDropdownBackgroundColor: $localNavButtonBackgroundColor-isSelected; | ||
$localDropdownFormNoteTextColor: #737373; | ||
$localTabTextColor: $localNavButtonTextColor; | ||
$localTabTextColor-isHover: $localNavButtonTextColor-isHover; | ||
$localTabTextColor-isSelected: $localNavButtonTextColor-isHover; | ||
|
||
// Dark theme colors | ||
$localNavTextColor--darkTheme: $textColor--darkTheme; | ||
$localNavBackgroundColor--darkTheme: #333333; | ||
$localNavButtonTextColor--darkTheme: #dedede; | ||
$localNavButtonTextColor-isHover--darkTheme: #ffffff; | ||
$localNavButtonBackgroundColor-isHover--darkTheme: #000000; | ||
$localNavButtonBackgroundColor-isSelected--darkTheme: #525252; | ||
$localNavBreadcrumbDelimiterColor--darkTheme: #a5a5a5; | ||
$localSearchBackgroundColor--darkTheme: #4e4e4e; | ||
$localSearchBorderColor-isInvalid--darkTheme: #ff6758; | ||
$localDropdownBackgroundColor--darkTheme: $localNavButtonBackgroundColor-isSelected--darkTheme; | ||
$localDropdownFormNoteTextColor--darkTheme: #a2a2a2; | ||
$localDropdownWarningTextColor--darkTheme: $textColor--darkTheme; | ||
$localDropdownWarningBackgroundColor--darkTheme: #636363; | ||
$localTabTextColor--darkTheme: $localNavButtonTextColor--darkTheme; | ||
$localTabTextColor-isHover--darkTheme: $localNavButtonTextColor-isHover--darkTheme; | ||
$localTabTextColor-isSelected--darkTheme: $localNavButtonTextColor-isHover--darkTheme; | ||
|
||
// Spacing | ||
$localNavSideSpacing: 10px; | ||
|
||
// Font size | ||
$localNavFontSizeNormal: 14px; | ||
|
||
@import "local_breadcrumbs"; | ||
@import "local_dropdown"; | ||
@import "local_menu"; | ||
@import "local_nav"; | ||
@import "local_search"; | ||
@import "local_tabs"; | ||
@import "local_title"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
/** | ||
* 1. Breadcrumbs are placed in the top-left corner and need to be bumped over | ||
* a bit. | ||
*/ | ||
.localBreadcrumbs { | ||
display: flex; | ||
align-items: center; | ||
height: 100%; | ||
padding-left: $localNavSideSpacing; /* 1 */ | ||
} | ||
|
||
.localBreadcrumb { | ||
& + & { | ||
margin-left: 6px; | ||
|
||
&:before { | ||
content: '/'; | ||
user-select: none; | ||
margin-right: 4px; | ||
color: $localNavBreadcrumbDelimiterColor; | ||
|
||
@include darkTheme { | ||
color: $localNavBreadcrumbDelimiterColor--darkTheme; | ||
} | ||
} | ||
} | ||
|
||
&:last-child { | ||
.localBreadcrumb__link { | ||
pointer-events: none; | ||
color: $localNavTextColor; | ||
|
||
@include darkTheme { | ||
color: $localNavTextColor--darkTheme; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
.localBreadcrumb__link { | ||
font-size: $localNavFontSizeNormal; | ||
color: #5a5a5a; | ||
text-decoration: none; | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
@include darkTheme { | ||
color: $localNavButtonTextColor--darkTheme; | ||
} | ||
} | ||
|
||
.localBreadcrumb__emphasis { | ||
font-weight: 700; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need
./node_modules/.bin/
when running npm scripts, thenode_modules/.bin
is included in the path by default in that case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks man!