Skip to content

Commit

Permalink
#1 Add functionality to edit name in new entry
Browse files Browse the repository at this point in the history
  • Loading branch information
markusbink committed Aug 13, 2022
1 parent c94bd47 commit 4171c73
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"phosphor-react": "^1.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-edit-text": "^5.0.2",
"react-scripts": "5.0.1",
"typescript": "^4.7.4",
"web-vitals": "^2.1.4"
Expand Down Expand Up @@ -44,6 +45,7 @@
]
},
"devDependencies": {
"@types/react-edit-text": "^5.0.1",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8"
Expand Down
21 changes: 18 additions & 3 deletions src/components/entry/NewEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import cx from "classnames";
import { CornersIn, CornersOut, FloppyDisk, X } from "phosphor-react";
import React, { useEffect, useState } from "react";
import { CornersIn, CornersOut, FloppyDisk, X, Pencil } from "phosphor-react";
import React, { useState } from "react";
import { UserRole } from "../../types";
import { Button } from "../Button";
import { Action } from "./Action";
import { EntryHeader } from "./EntryHeader";
import { EditText } from "react-edit-text";
import "react-edit-text/dist/index.css";

interface NewEntryProps {
parentRole: "Kläger" | "Beklagter";
Expand Down Expand Up @@ -35,7 +37,20 @@ export const NewEntry: React.FC<NewEntryProps> = ({
className="rounded-b-none cursor-default"
isPlaintiff={!isPlaintiff}
>
<span className="font-bold">Stefan Schneider</span>
<EditText
inputClassName={cx("font-bold focus:outline-none bg-transparent", {
"border-darkPurple": !isPlaintiff,
"border-darkPetrol": isPlaintiff,
})}
className={cx("font-bold", {
"text-darkPurple": !isPlaintiff,
"text-darkPetrol": isPlaintiff,
})}
defaultValue="Stefan Schneider"
showEditButton
editButtonContent={<Pencil size={18} />}
editButtonProps={{ className: cx("bg-transparent") }}
/>
</EntryHeader>
{/* Toolbar */}
<div
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
theme: {
extend: {},
colors: {
transparent: "transparent",
white: "#fff",
offWhite: "#F5F5F5",
lightGrey: "#E4E4E4",
Expand Down

0 comments on commit 4171c73

Please sign in to comment.