Skip to content

Commit

Permalink
feat: add lock icon when field is read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Oct 31, 2023
1 parent 1530de7 commit a051000
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/components/InputOrGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DefaultField,
TextareaField,
} from "./fields";
import { Lock } from "react-feather";

const getClassName = getClassNameFactory("Input", styles);

Expand All @@ -35,6 +36,12 @@ export const FieldLabel = ({
<div className={getClassName("label")}>
{icon ? <div className={getClassName("labelIcon")}>{icon}</div> : <></>}
{label}

{readOnly && (
<div className={getClassName("disabledIcon")} title="Read-only">
<Lock size="12" />
</div>
)}
</div>
{children}
</El>
Expand Down
6 changes: 6 additions & 0 deletions packages/core/components/InputOrGroup/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
.Input-labelIcon {
color: var(--puck-color-grey-6);
margin-right: 4px;
padding-left: 4px;
}

.Input-disabledIcon {
color: var(--puck-color-grey-4);
margin-left: auto;
}

.Input-input {
Expand Down

0 comments on commit a051000

Please sign in to comment.