-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(many): add data visualization colors, refactor theme code
- Loading branch information
Showing
58 changed files
with
1,051 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Accessing the DOM | ||
category: Guides | ||
order: 6 | ||
order: 4 | ||
--- | ||
|
||
## Accessing the DOM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Color System | ||
category: Guides | ||
order: 5 | ||
--- | ||
|
||
## Colors | ||
|
||
Colors are divided into two main technical groups: primitive and semantic colors. Primitive colors store the pure hex values. The primitive colors are the building blocks of the semantic colors. Examples of semantic colors: ui, contrasts, dataVisualization. | ||
|
||
### Primitives | ||
|
||
These are here for reference only, usually not needed for InstUI development. Available from the themes and from `@instructure/ui-themes` | ||
|
||
```jsx | ||
--- | ||
type: example | ||
--- | ||
<ThemeColors colors={canvas.colors.primitives} label=""></ThemeColors> | ||
``` | ||
|
||
### Additional Primitives | ||
|
||
These are here for reference only, usually not needed for InstUI development. Available from `@instructure/ui-themes` | ||
|
||
```jsx | ||
--- | ||
type: example | ||
--- | ||
<ThemeColors colors={additionalPrimitives} label=""></ThemeColors> | ||
``` | ||
|
||
### Data visualization | ||
|
||
The color names show their hue value and their contrast value on a white background. They don't tell how to use them or for what data they can be applied to. Each hue has 4 primary and 5 secondary colors. | ||
|
||
- The data visualization color palette is for data representation only. Like graphs, chars and plots. | ||
- These are solid colors and can not be used for creating gradients. | ||
- First you have to use all 4 of the primary colors of a hue, then you can use the 5 secondary ones. | ||
- Use them on a white background | ||
|
||
Available from `@instructure/ui-themes` | ||
|
||
```jsx | ||
--- | ||
type: example | ||
--- | ||
<ColorTable colors={dataVisualization} colorNames={additionalPrimitives}></ColorTable> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Focus Management | ||
category: Guides | ||
order: 5 | ||
order: 3 | ||
--- | ||
|
||
## The Focus Management Problem | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** @jsx jsx */ | ||
import { Component } from 'react' | ||
import { jsx } from '@instructure/emotion' | ||
|
||
import { Heading } from '../Heading' | ||
import { Table } from '@instructure/ui-table' | ||
import { View } from '@instructure/ui-view' | ||
import { ColorSwatch } from '../ColorSwatch' | ||
import { ColorTableProps } from './props' | ||
|
||
class ColorTable extends Component<ColorTableProps> { | ||
renderRows() { | ||
const colorMap = Object.keys(this.props.colorNames).reduce((acc, color) => { | ||
const hex = this.props.colorNames[color] | ||
return { ...acc, [hex]: color } | ||
}, {}) | ||
|
||
return Object.keys(this.props.colors).map((key) => ( | ||
<Table.Row key={key}> | ||
<Table.Cell> | ||
<code>{key}</code> | ||
</Table.Cell> | ||
<Table.Cell> | ||
<View margin="0 xx-small 0 0"> | ||
<ColorSwatch color={this.props.colors[key]} /> | ||
</View> | ||
<code> | ||
{colorMap[this.props.colors[key]]}{' '} | ||
<span css={{ font: '#334451', fontSize: '0.875rem' }}> | ||
({this.props.colors[key]}) | ||
</span> | ||
</code> | ||
</Table.Cell> | ||
</Table.Row> | ||
)) | ||
} | ||
|
||
render() { | ||
const headingElement = 'h3' | ||
const headingLevel = 'h2' | ||
const margin = 'small none large' | ||
const padding = 'small' | ||
const label = 'name' + 'variables' | ||
return ( | ||
<View key={label} as="div" padding={'none'}> | ||
<Heading as={headingElement} level={headingLevel}></Heading> | ||
<View | ||
as="div" | ||
background="secondary" | ||
padding={padding} | ||
margin={margin} | ||
borderRadius="medium" | ||
> | ||
<Table caption={label} layout="fixed"> | ||
<Table.Head> | ||
<Table.Row> | ||
<Table.ColHeader id="Name" key="Name"> | ||
Name | ||
</Table.ColHeader> | ||
<Table.ColHeader id="Value" key="value"> | ||
Value | ||
</Table.ColHeader> | ||
</Table.Row> | ||
</Table.Head> | ||
<Table.Body>{this.renderRows()}</Table.Body> | ||
</Table> | ||
</View> | ||
</View> | ||
) | ||
} | ||
} | ||
|
||
export default ColorTable | ||
export { ColorTable } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.