diff --git a/components/mastery/AxSelect/index.module.scss b/components/mastery/AxSelect/index.module.scss index 1f1135b5..f5fefb4e 100644 --- a/components/mastery/AxSelect/index.module.scss +++ b/components/mastery/AxSelect/index.module.scss @@ -1,9 +1,9 @@ -.AXSelect { +.ax { display: flex; flex-direction: column; gap: $unit; - .AXSet { + .set { &.hidden { display: none; } @@ -22,26 +22,6 @@ display: flex; flex-direction: row; gap: $unit; - - .SelectTrigger { - flex-grow: 1; - margin: 0; - } - - input { - -webkit-font-smoothing: antialiased; - border: none; - border-radius: $input-corner; - box-sizing: border-box; - display: none; - text-align: right; - min-width: $unit-14x; - width: 100px; - - &.Visible { - display: block; - } - } } } } diff --git a/components/mastery/AxSelect/index.tsx b/components/mastery/AxSelect/index.tsx index 9e156ab4..a1284363 100644 --- a/components/mastery/AxSelect/index.tsx +++ b/components/mastery/AxSelect/index.tsx @@ -1,7 +1,8 @@ -import React, { ForwardedRef, useEffect, useState } from 'react' +import React, { useEffect, useState } from 'react' import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' +import Input from '~components/common/Input' import Select from '~components/common/Select' import SelectItem from '~components/common/SelectItem' @@ -45,14 +46,19 @@ const AXSelect = (props: Props) => { axValue2: '', }) + const inputClasses = classNames({ + fullHeight: true, + range: true, + }) + const primaryErrorClasses = classNames({ - errors: true, - visible: errors.axValue1.length > 0, + [styles.errors]: true, + [styles.visible]: errors.axValue1.length > 0, }) const secondaryErrorClasses = classNames({ - errors: true, - visible: errors.axValue2.length > 0, + [styles.errors]: true, + [styles.visible]: errors.axValue2.length > 0, }) // Refs @@ -139,8 +145,8 @@ const AXSelect = (props: Props) => { // Classes const secondarySetClasses = classNames({ - AXSet: true, - hidden: primaryAxModifier < 0, + [styles.set]: true, + [styles.hidden]: primaryAxModifier < 0, }) function setupAx1() { @@ -271,7 +277,7 @@ const AXSelect = (props: Props) => { // Reset the secondary AX modifier, reset the AX value and hide the input setSecondaryAxModifier(-1) setSecondaryAxValue(0) - secondaryAxValueInput.current.className = 'Input Contained' + // secondaryAxValueInput.current.className = 'Input Contained' secondaryAxValueInput.current.value = '' } } @@ -377,7 +383,7 @@ const AXSelect = (props: Props) => { if (ax) { const rangeString = `${ax.minValue}~${ax.maxValue}${ax.suffix || ''}` - element.className = 'Input Bound Visible' + // element.className = 'Input Bound Visible' element.disabled = false element.placeholder = rangeString element.min = `${ax.minValue}` @@ -386,12 +392,12 @@ const AXSelect = (props: Props) => { } else { if (primaryAxValueInput.current && secondaryAxValueInput.current) { if (primaryAxValueInput.current == element) { - primaryAxValueInput.current.className = 'Input Contained' + // primaryAxValueInput.current.className = 'Input Contained' primaryAxValueInput.current.disabled = true primaryAxValueInput.current.placeholder = '' } - secondaryAxValueInput.current.className = 'Input Contained' + // secondaryAxValueInput.current.className = 'Input Contained' secondaryAxValueInput.current.disabled = true secondaryAxValueInput.current.placeholder = '' } @@ -399,24 +405,31 @@ const AXSelect = (props: Props) => { } return ( -