Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(nms): Remove fbc-js-core select component #12614

Merged
merged 1 commit into from
May 10, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions nms/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ module.exports = {
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-react-jsx',
'babel-plugin-fbt',
'babel-plugin-fbt-runtime',
],
env: {
test: {
Expand Down
37 changes: 12 additions & 25 deletions nms/fbc_js_core/ui/components/auth/EditUserDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import ListItemText from '@material-ui/core/ListItemText';
import MenuItem from '@material-ui/core/MenuItem';
import React, {useCallback, useContext, useMemo, useState} from 'react';
import Select from '@material-ui/core/Select';
import SymphonySelect from '../../../../fbc_js_core/ui/components/design-system/Select/Select';
import TextField from '@material-ui/core/TextField';
import renderList from '../../../../fbc_js_core/util/renderList';
import {UserRoles} from '../../../../fbc_js_core/auth/types';
Expand Down Expand Up @@ -164,30 +163,18 @@ export default function EditUserDialog(props: Props) {
/>
</>
)}
<SymphonySelect
className={classes.select}
skin="gray"
label="Role"
options={[
{
key: 'user',
label: 'User',
value: UserRoles.USER,
},
{
key: 'read_only_user',
label: 'Read Only User',
value: UserRoles.READ_ONLY_USER,
},
{
key: 'super_user',
label: 'Super User',
value: UserRoles.SUPERUSER,
},
]}
selectedValue={role}
onChange={value => setRole(value)}
/>
<FormControl className={classes.input}>
<InputLabel id="role-select-label">Role</InputLabel>
<Select
labelId="role-select-label"
id="role-select"
value={role}
onChange={({target}) => setRole(target.value)}>
<MenuItem value={UserRoles.USER}>User</MenuItem>
<MenuItem value={UserRoles.READ_ONLY_USER}>Read Only User</MenuItem>
<MenuItem value={UserRoles.SUPERUSER}>Super User</MenuItem>
</Select>
</FormControl>
{isTabEnabled('nms') && allNetworkIDs && (
<FormControl className={classes.input}>
<InputLabel htmlFor="network_ids">Accessible Networks</InputLabel>
Expand Down
22 changes: 2 additions & 20 deletions nms/fbc_js_core/ui/components/design-system/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import * as React from 'react';
import Text from '../../../../app/theme/design-system/Text';
import classNames from 'classnames';
import {colors} from '../../../../app/theme/default';
import {joinNullableStrings} from '../../../../fbc_js_core/util/strings';
import {makeStyles} from '@material-ui/styles';
import {useFormElementContext} from './Form/FormElementContext';
import {useMemo} from 'react';

const useStyles = makeStyles(_theme => ({
root: {
Expand Down Expand Up @@ -314,33 +311,18 @@ const Button = (props: Props, forwardedRef: TRefFor<HTMLButtonElement>) => {
className,
children,
skin = 'primary',
disabled: disabledProp = false,
disabled = false,
variant = 'contained',
useEllipsis = true,
onClick,
leftIcon: LeftIcon = null,
leftIconClass = null,
rightIcon: RightIcon = null,
rightIconClass = null,
tooltip: tooltipProp,
tooltip,
} = props;
const classes = useStyles();

const {
disabled: contextDisabled,
tooltip: contextTooltip,
} = useFormElementContext();

const disabled = useMemo(() => disabledProp || contextDisabled, [
disabledProp,
contextDisabled,
]);

const tooltip = useMemo(
() => joinNullableStrings([tooltipProp, contextTooltip]),
[contextTooltip, tooltipProp],
);

return (
<button
className={classNames(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import TextPairingContainer from '../helpers/TextPairingContainer';
import classNames from 'classnames';
import {colors} from '../../../../../app/theme/default';
import {makeStyles} from '@material-ui/styles';
import {useFormElementContext} from '../Form/FormElementContext';
import {useMemo} from 'react';

const useStyles = makeStyles(_theme => ({
root: {
Expand Down Expand Up @@ -72,7 +70,7 @@ const Checkbox = (props: Props) => {
indeterminate,
onChange,
onClick,
disabled: propDisabled = false,
disabled = false,
...TextPairingContainerProps
} = props;
const classes = useStyles();
Expand All @@ -82,12 +80,6 @@ const Checkbox = (props: Props) => {
? CheckBoxIcon
: CheckBoxOutlineBlankIcon;

const {disabled: contextDisabled} = useFormElementContext();
const disabled = useMemo(
() => (propDisabled ? propDisabled : contextDisabled),
[contextDisabled, propDisabled],
);

return (
<TextPairingContainer {...TextPairingContainerProps} disabled={disabled}>
<div
Expand Down

This file was deleted.