Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stateful/vscode-marquee
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a4ff29347175b960ba1d6db8f1bb8aa7d2d24029
Choose a base ref
..
head repository: stateful/vscode-marquee
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6ef1b4340c2c11dc7ee6c05048ee8bebb3324091
Choose a head ref
Showing with 10 additions and 1 deletion.
  1. +10 −1 packages/widget-todo/src/components/ChipInput.tsx
11 changes: 10 additions & 1 deletion packages/widget-todo/src/components/ChipInput.tsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@ import React, { KeyboardEvent } from "react";
import Chip from "@material-ui/core/Chip";
import TextField from "@material-ui/core/TextField";
import { InputAdornment, TextFieldProps } from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";

const useStyles = makeStyles(() => ({
textField: {
marginTop: 5,
},
}));

type Props = Omit<TextFieldProps, "value" | "onChange"> & {
value: Array<string>;
@@ -15,9 +22,10 @@ export default function TagsInput({
...inputProps
}: Props) {
const [inputValue, setInputValue] = React.useState("");
const classes = useStyles();

const addTag = () => {
if (!value.includes(inputValue)) {
if (inputValue.length > 0 && !value.includes(inputValue)) {
// only add new tag if it's not a duplicate
onChange([...value, inputValue]);
}
@@ -60,6 +68,7 @@ export default function TagsInput({
<TextField
value={inputValue}
InputProps={{
className:classes.textField,
startAdornment: value.map((item) => (
<InputAdornment key={item} position="start">
<Chip