Skip to content

Commit

Permalink
fixing lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Dong Kyun David Kim committed Oct 20, 2021
1 parent 2bd40c8 commit b6c3e7f
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 35 deletions.
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ We use a variation on [BEM Naming Conventions](http://getbem.com/introduction/)
```css
.component-name--element__modifier
```

```css
// example:
.button--checkbox__active
Expand Down Expand Up @@ -101,16 +102,20 @@ We offer larger groups of components that are intended to be used together close
import {FruitApple} from './FruitApple'
import {FruitOrange} from './FruitOrange'
```

```tsx
export class Fruit {
public static Apple = FruitApple
public static Orange = FruitOrange
}
```

This enables usage like so:

```tsx
import {Fruit} from '@influxdata/clockface'
```

```tsx
<Fruit.Apple />
<Fruit.Orange />
Expand All @@ -133,6 +138,7 @@ import {Fruit} from '@influxdata/clockface'
FruitExample.md
Fruit.stories.tsx
```

We strongly encourage including examples of all the components in a family working together

### 4. The Consistent Customization Pattern
Expand All @@ -158,6 +164,6 @@ $cf-radius: 4px;

When creating or modifying components use these size variables. There also other variables located in [variables.scss](https://github.com/influxdata/clockface/blob/master/src/Styles/variables.scss) that are useful for ensuring visual consistency

--------------
---

# More Coming Soon
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@
"storybook": "start-storybook -p 9001 -c .storybook",
"publishStorybook": "storybook-to-ghpages --out=.out"
}
}
}
4 changes: 3 additions & 1 deletion src/Components/ColorPicker/ColorPickerSwatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ export const ColorPickerSwatch = forwardRef<
onClick(hex)
}

const title = name ? name : hex

return (
<div
className={colorPickerSwatchClass}
title={hex}
title={title}
onClick={handleClick}
data-testid={`${testID}--swatch`}
style={colorPickerSwatchStyle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ resourceListExampleStories.add(
value=""
selected={false}
wrapText={false}
/* eslint-disable */
onClick={() => {}}
/* eslint-enable */
backgroundColor={InfluxColors.Pool}
size={ComponentSize.Small}
>
Expand Down Expand Up @@ -515,23 +517,29 @@ resourceListExampleStories.add(
name="CRIT"
color="#da3434"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
<Label
id="WARN"
description="I'm a cool label"
name="WARN"
color="#f2b218"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable*/
/>
<Label
id="OK"
description="I'm a cool label"
name="OK"
color="#6ac255"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
</FlexBox>
</ResourceCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ selectGroupStories.add(
]
}
>
{mirepoix.map((btn, i) => {
{mirepoix.map(btn => {
const isSelectGroup =
select('type', mapEnumKeys(InputToggleType), 'SelectGroup') ===
'SelectGroup'
Expand Down
2 changes: 2 additions & 0 deletions src/Components/SelectGroup/SelectGroupOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export const SelectGroupOption = forwardRef<
testID = 'select-group--option',
active,
onClick,
/* eslint-disable */
onKeyUp,
/* eslint-enable */
tabIndex,
disabled = false,
children,
Expand Down
4 changes: 2 additions & 2 deletions src/Constants/colors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, InfluxColors } from '../Types'
import {Color, InfluxColors} from '../Types'

export const influxColors: Color[] = [
// Row 1
Expand Down Expand Up @@ -486,7 +486,7 @@ export const influxGradients = {
Info: {
start: InfluxColors.Pool,
stop: InfluxColors.Pulsar,
}
},
}

export const dropdownScrollColors = {
Expand Down
14 changes: 14 additions & 0 deletions src/Sandbox/Cards.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ function CardBucketsFull() {
name="user:influx"
color="#9AF445"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
</FlexBox>
<FlexBox direction={FlexDirection.Row} margin={ComponentSize.Medium}>
Expand Down Expand Up @@ -188,9 +190,11 @@ function CardDisabled() {
margin={ComponentSize.Medium}
>
<SlideToggle
/* eslint-disable */
onChange={() => {
// Do nothing
}}
/* eslint-enable */
size={ComponentSize.ExtraSmall}
active={false}
/>
Expand Down Expand Up @@ -287,23 +291,29 @@ function CardAll() {
name="CRIT"
color="#da3434"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
<Label
id="WARN"
description="I'm a cool label"
name="WARN"
color="#f2b218"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
<Label
id="OK"
description="I'm a cool label"
name="OK"
color="#6ac255"
size={ComponentSize.ExtraSmall}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
</FlexBox>
</ResourceCard>
Expand All @@ -321,9 +331,11 @@ function CardTask() {
margin={ComponentSize.Medium}
>
<SlideToggle
/* eslint-disable */
onChange={() => {
// Do nothing
}}
/* eslint-enable */
size={ComponentSize.ExtraSmall}
active={true}
/>
Expand Down Expand Up @@ -390,7 +402,9 @@ function CardLabel() {
name="Analytics"
color="#C5F98D"
size={ComponentSize.Small}
/* eslint-disable */
onDelete={() => {}}
/* eslint-enable */
/>
<span>No description</span>
</ResourceCard.Meta>
Expand Down
36 changes: 18 additions & 18 deletions src/Types/Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ Clockface offers a set of common `enum` data types which control the appearance

### Data Types Reference

| Name | Values |
|:-------------------|:----------------------------------------------------------------|
| `ComponentColor` | `Default` `Primary` `Danger` `Tertiary` `Colorless` |
| `ComponentSize` | `ExtraSmall` `Small` `Medium` `Large` |
| `ComponentStatus` | `Default` `Loading` `Error` `Valid` `Disabled` |
| `DropdownMenuTheme` | `Amethyst` `Malachite` `Sapphire` `Onyx` |
| `DropdownItemType` | `Dot` `Checkbox` `None` |
| `ButtonShape` | `Default` `Square` `StretchToFit` |
| `ButtonType` | `Button` `Submit` |
| `Columns` | `One` `Two` `Three` `Four` `Five` `Six` `Seven` `Eight` `Nine` `Ten` `Eleven` `Twelve` |
| `Sort` | `Descending` `Ascending` `None` |
| `Alignment` | `Left` `Center` `Right` |
| `JustifyContent` | `FlexStart` `Center` `FlexEnd` `SpaceAround` `SpaceBetween` |
| `AlignItems` | `FlexStart` `Center` `FlexEnd` `Stretch` |
| `FlexDirection` | `Row` `RowReverse` `Column` `ColumnReverse` |
| `RemoteDataState` | `NotStarted` `Loading` `Done` `Error` |
| `AutoComplete` | `On` `Off` |
| `Orientation` | `Horizontal` `Vertical` |
| Name | Values |
| :------------------ | :------------------------------------------------------------------------------------- |
| `ComponentColor` | `Default` `Primary` `Danger` `Tertiary` `Colorless` |
| `ComponentSize` | `ExtraSmall` `Small` `Medium` `Large` |
| `ComponentStatus` | `Default` `Loading` `Error` `Valid` `Disabled` |
| `DropdownMenuTheme` | `Amethyst` `Malachite` `Sapphire` `Onyx` |
| `DropdownItemType` | `Dot` `Checkbox` `None` |
| `ButtonShape` | `Default` `Square` `StretchToFit` |
| `ButtonType` | `Button` `Submit` |
| `Columns` | `One` `Two` `Three` `Four` `Five` `Six` `Seven` `Eight` `Nine` `Ten` `Eleven` `Twelve` |
| `Sort` | `Descending` `Ascending` `None` |
| `Alignment` | `Left` `Center` `Right` |
| `JustifyContent` | `FlexStart` `Center` `FlexEnd` `SpaceAround` `SpaceBetween` |
| `AlignItems` | `FlexStart` `Center` `FlexEnd` `Stretch` |
| `FlexDirection` | `Row` `RowReverse` `Column` `ColumnReverse` |
| `RemoteDataState` | `NotStarted` `Loading` `Done` `Error` |
| `AutoComplete` | `On` `Off` |
| `Orientation` | `Horizontal` `Vertical` |

<!-- STORY HIDE START -->

Expand Down
22 changes: 11 additions & 11 deletions src/Utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//Libraries
import { CSSProperties } from 'react'
import {CSSProperties} from 'react'
import chroma from 'chroma-js'
import { uniq, shuffle, capitalize, random } from 'lodash'
import {uniq, shuffle, capitalize, random} from 'lodash'

// Constants
import { getColorsFromGradient } from '../Utils/colors'
import {getColorsFromGradient} from '../Utils/colors'

// Types
import {
Expand Down Expand Up @@ -34,7 +34,7 @@ export const calculateTextColorFromBackground = (
const mediumGrey = 0.37

if (gradient) {
const { start } = getColorsFromGradient(gradient)
const {start} = getColorsFromGradient(gradient)
return chroma(start).luminance() >= mediumGrey ? 'dark' : 'light'
}

Expand All @@ -57,7 +57,7 @@ export const generateBackgroundStyle = (
}

let border = `2px solid ${backgroundColor}`
let panelStyle: CSSProperties = { backgroundColor }
let panelStyle: CSSProperties = {backgroundColor}

if (gradient) {
const colors = getColorsFromGradient(gradient)
Expand All @@ -72,11 +72,11 @@ export const generateBackgroundStyle = (
}

if (bordered) {
panelStyle = { ...panelStyle, border }
panelStyle = {...panelStyle, border}
}

if (style) {
return { ...panelStyle, ...style }
return {...panelStyle, ...style}
}

return panelStyle
Expand All @@ -88,7 +88,7 @@ export const generateTextBlockStyle = (
style?: CSSProperties
): CSSProperties | undefined => {
if (!backgroundColor) {
return { color: `${textColor}`, ...style }
return {color: `${textColor}`, ...style}
}

const contrastingTextColor =
Expand All @@ -102,7 +102,7 @@ export const generateTextBlockStyle = (
color = `${textColor}`
}

return { backgroundColor, color, ...style }
return {backgroundColor, color, ...style}
}

export const generateLabelStyle = (
Expand Down Expand Up @@ -153,7 +153,7 @@ export const generateTechnoSpinnerStyle = (
borderWidth = 8
}

return { width, height, borderWidth, ...style }
return {width, height, borderWidth, ...style}
}

export const generateRangeSliderTrackFillStyle = (
Expand All @@ -165,7 +165,7 @@ export const generateRangeSliderTrackFillStyle = (
status: ComponentStatus
): CSSProperties | undefined => {
if (status === ComponentStatus.Disabled) {
return { background: InfluxColors.Castle }
return {background: InfluxColors.Castle}
}

const fillColor = {
Expand Down

0 comments on commit b6c3e7f

Please sign in to comment.