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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic link padding #43

Merged
merged 2 commits into from
Oct 2, 2021
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
26 changes: 25 additions & 1 deletion components/genaralform.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,31 @@ const GenaralForm = ({ data, update, loading }) => {
rows="3"
{...register("handlerDescription")}
></textarea>
</div>
</div>{" "}
<div className="mb-3 ">
<label className="form-label">Link padding</label>
<div className="input-group mb-3">
<input
type="number"
className={
errors.linkPadding
? "form-control is-invalid"
: "form-control"
}
placeholder="Enter Link padding "
{...register("linkPadding", {
// max: { message: "Width must be below 100%", value: 100 },
min: { message: "Padding must be above 0em", value: 0 },
})}
/>{" "}
<span className="input-group-text">em</span>{" "}
{errors.linkPadding && (
<div className="invalid-feedback">
{errors.linkPadding.message}
</div>
)}
</div>
</div>{" "}
<div className="mb-3 ">
<label className="form-label">Avatar width</label>
<div className="input-group mb-3">
Expand Down
4 changes: 3 additions & 1 deletion components/linkinthebiopage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function Home({
handlerDescription,
bgImgUrl,
footerEnabled,
linkPadding,
preview = false,
}) {
accentColor = isEmpty(accentColor) ? "#BDD7FF" : accentColor;
Expand All @@ -35,6 +36,7 @@ export default function Home({
footerTextSize = isEmpty(footerTextSize) ? 12 : footerTextSize;
footerBgColor = isEmpty(footerBgColor) ? "#000000" : footerBgColor;
footerTextColor = isEmpty(footerTextColor) ? "#ffffff" : footerTextColor;
linkPadding = isEmpty(linkPadding) ? "2em" : `${linkPadding}em`;

return (
<div>
Expand Down Expand Up @@ -177,7 +179,7 @@ export default function Home({
margin: 14px 0;
}
.link {
padding: 2rem;
padding: ${linkPadding};
display: flex;
text-align: center;
text-decoration: none;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "pagedata" ADD COLUMN "linkPadding" VARCHAR;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ model pagedata {
handlerDescription String? @db.VarChar
handlerDescriptionFontColor String? @db.VarChar
footerEnabled Boolean? @default(true)
linkPadding String? @db.VarChar
}

model users {
Expand Down