Skip to content

Commit

Permalink
refactor(ld-theme): move theme name type into component
Browse files Browse the repository at this point in the history
  • Loading branch information
borisdiakur committed Aug 26, 2021
1 parent a6fca8f commit 9d8f662
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 72 deletions.
4 changes: 2 additions & 2 deletions src/docs/components/docs-example/docs-example.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../../../components' // type definitions for type checking and intelliSense
import { Component, h, Host, Prop, Listen, State } from '@stencil/core'
import { ThemeName } from '../../../liquid/types/theme'
import { ThemeName } from '../../../liquid/components/ld-theme/ld-theme'

/** @internal **/
@Component({
Expand Down Expand Up @@ -28,7 +28,7 @@ export class DocsExample {
@Prop() themable = false

/** Current theme. */
@State() currentTheme: ThemeName = ThemeName.ocean
@State() currentTheme: ThemeName = 'ocean'

/** Is code toggled to be visible */
@State() isCodeVisible = this.opened
Expand Down
12 changes: 3 additions & 9 deletions src/docs/components/docs-pick-theme/docs-pick-theme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../../../components' // type definitions for type checks and intelliSense
import { Component, h, Host, Event, EventEmitter, State } from '@stencil/core'
import { ThemeName } from '../../../liquid/types/theme'
import { ThemeName } from '../../../liquid/components/ld-theme/ld-theme'

/** @internal **/
@Component({
Expand All @@ -9,7 +9,7 @@ import { ThemeName } from '../../../liquid/types/theme'
shadow: false,
})
export class DocsPickTheme {
@State() currentTheme: ThemeName = ThemeName.ocean
@State() currentTheme: ThemeName = 'ocean'

/** Theme pick change event. */
@Event() pickTheme: EventEmitter<'' | ThemeName>
Expand All @@ -19,13 +19,7 @@ export class DocsPickTheme {
this.currentTheme = ev.detail[0]
}

private themes = [
ThemeName.ocean,
ThemeName.bubblegum,
ThemeName.shake,
ThemeName.solvent,
ThemeName.tea,
]
private themes = ['ocean', 'bubblegum', 'shake', 'solvent', 'tea']

render() {
let cl = 'docs-pick-theme'
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-bg-cells/test/ld-bg-cells.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

async function getPageWithContent(content, theme = 'none') {
const page = await newE2EPage()
Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]
const cellTypes = [
'bioreliance',
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-button/test/ld-button.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
// ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
ThemeName.tea.toLowerCase(),
'ocean',
// 'bubblegum',
// 'shake',
// 'solvent',
'tea',
]

const modes = [
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-checkbox/test/ld-checkbox.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]

const tones = [undefined, 'dark']
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-input/test/ld-input.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]

const tones = [undefined, 'dark']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]

const allowableMismatchedRatio = 0.02
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-radio/test/ld-radio.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -18,11 +17,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]

const tones = [undefined, 'dark']
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-select/test/ld-select.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -20,11 +19,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
// 'none',
// ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
// 'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]

const selectIcon = `
Expand Down
2 changes: 2 additions & 0 deletions src/liquid/components/ld-theme/ld-theme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import '../../components' // type definitions for type checks and intelliSense
import { Component, h, Host, Prop } from '@stencil/core'

export type ThemeName = 'bubblegum' | 'ocean' | 'shake' | 'solvent' | 'tea'

/**
* @virtualProp ref - reference to component
* @virtualProp {string | number} key - for tracking the node's identity when working with lists
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-toggle/test/ld-toggle.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -19,11 +18,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]
const checkedStates = [false, true]
const allowableMismatchedPixels = 2000
Expand Down
11 changes: 5 additions & 6 deletions src/liquid/components/ld-tooltip/test/ld-tooltip.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { newE2EPage } from '@stencil/core/testing'
import { ThemeName } from '../../../types/theme'

jest.useRealTimers()

Expand All @@ -22,11 +21,11 @@ async function getPageWithContent(content, theme = 'none') {

const themes = [
'none',
ThemeName.ocean.toLowerCase(),
ThemeName.bubblegum.toLowerCase(),
// ThemeName.shake.toLowerCase(),
// ThemeName.solvent.toLowerCase(),
// ThemeName.tea.toLowerCase(),
'ocean',
'bubblegum',
// 'shake',
// 'solvent',
// 'tea',
]
const positions = [
'bottom center',
Expand Down
7 changes: 0 additions & 7 deletions src/liquid/types/theme.ts

This file was deleted.

0 comments on commit 9d8f662

Please sign in to comment.