Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions packages/math-input/src/keypad/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Button from '@mui/material/Button';
import IconButton from '@mui/material/IconButton';
import { alpha, lighten, styled } from '@mui/material/styles';
import { indigo, pink } from '@mui/material/colors';
import { styled } from '@mui/material/styles';
import debug from 'debug';
import { flatten } from 'lodash-es';
import { color } from '@pie-lib/render-ui';
Expand All @@ -27,7 +26,7 @@ const LatexButtonContent = styled(mq.Static)(({ latex }) => {
marginBottom: '0.9px !important',
},
'& .mq-empty': {
backgroundColor: `${alpha(pink[300], 0.4)} !important`,
backgroundColor: `${color.keypadEmptyPlaceholder()} !important`,
},
'& .mq-overline .mq-overline-inner': {
borderTop: '2px solid black',
Expand Down Expand Up @@ -186,22 +185,20 @@ const KeyPadContainer = styled('div')(() => ({

const StyledButton = styled(Button)(({ category, isDelete, isComma, isDot }) => ({
minWidth: 'auto',
textTransform: 'none',
fontSize: isComma || isDot ? '200% !important' : '140% !important',
lineHeight: isComma || isDot ? '100%' : 'normal',
color: color.text(),

backgroundColor:
category === 'operators'
? lighten(pink[300], 0.5)
: // this code with green seems to not be applied to current implementation, so I commented it out, but left it here just in case
// category === 'comparison' ? lighten(green[500], 0.5) :
lighten(indigo[300], 0.5),
? color.keypadButtonOperator()
: color.keypadButton(),
'&:hover': {
backgroundColor:
category === 'operators'
? lighten(pink[300], 0.7)
: // category === 'comparison' ? lighten(green[500], 0.7) :
lighten(indigo[300], 0.7),
? color.keypadButtonOperator()
: color.keypadButton(),
},
borderRadius: 0,
...(isDelete && {
Expand All @@ -218,31 +215,27 @@ const StyledLatexButtonWrapper = styled(Button)(({ category }) => ({
borderRadius: 0,
backgroundColor:
category === 'operators'
? lighten(pink[300], 0.5)
: // category === 'comparison' ? lighten(green[500], 0.5) :
lighten(indigo[300], 0.5),
? color.keypadButtonOperator()
: color.keypadButton(),
'&:hover': {
backgroundColor:
category === 'operators'
? lighten(pink[300], 0.7)
: // category === 'comparison' ? lighten(green[500], 0.7) :
lighten(indigo[300], 0.7),
? color.keypadButtonOperator()
: color.keypadButton(),
},
}));

const StyledIconButton = styled(IconButton)(({ category }) => ({
minWidth: 'auto',
backgroundColor:
category === 'operators'
? lighten(pink[300], 0.5)
: // category === 'comparison' ? lighten(green[500], 0.5) :
lighten(indigo[300], 0.5),
? color.keypadButtonOperator()
: color.keypadButton(),
'&:hover': {
backgroundColor:
category === 'operators'
? lighten(pink[300], 0.7)
: // category === 'comparison' ? lighten(green[500], 0.7) :
lighten(indigo[300], 0.7),
? color.keypadButtonOperator()
: color.keypadButton(),
},
borderRadius: 0,
'& .icon': {
Expand Down
7 changes: 7 additions & 0 deletions packages/render-ui/src/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export const defaults = {
BLUE_GREY900: '#152452',
// this is used for charting
FADED_PRIMARY: '#DCDAFB',
// these are used for the math keypad buttons
KEYPAD_BUTTON: 'rgb(188, 194, 229)',
KEYPAD_BUTTON_OPERATOR: 'rgb(255, 159, 192)',
KEYPAD_EMPTY_PLACEHOLDER: 'rgba(245, 0, 87, 0.4)',
// these are used for graphing UI elements
BUTTON_BORDER: 'rgba(0, 0, 0, 0.23)',
BUTTON_HOVER_BG: 'rgba(0, 0, 0, 0.08)',
Expand Down Expand Up @@ -114,6 +118,9 @@ export const blueGrey300 = () => pv('blue-grey-300', defaults.BLUE_GREY300);
export const blueGrey600 = () => pv('blue-grey-600', defaults.BLUE_GREY600);
export const blueGrey900 = () => pv('blue-grey-900', defaults.BLUE_GREY900);

export const keypadButton = () => pv('keypad-button', defaults.KEYPAD_BUTTON);
export const keypadButtonOperator = () => pv('keypad-button-operator', defaults.KEYPAD_BUTTON_OPERATOR);
export const keypadEmptyPlaceholder = () => pv('keypad-empty-placeholder', defaults.KEYPAD_EMPTY_PLACEHOLDER);
export const buttonBorder = () => pv('button-border', defaults.BUTTON_BORDER);
export const buttonHoverBg = () => pv('button-hover-bg', defaults.BUTTON_HOVER_BG);

Expand Down
Loading