Rename title to name

This commit is contained in:
Aditya Thakral 2021-04-01 19:03:30 -04:00
parent ee4f7f5f10
commit 7e9ff1dfb9
5 changed files with 10 additions and 9 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ links.db
password.txt password.txt
/.vs /.vs
/.vscode /.vscode
/links.json

View File

@ -2,7 +2,7 @@ import React, { useRef, useState } from "react";
import { Draggable } from "react-beautiful-dnd"; import { Draggable } from "react-beautiful-dnd";
export type EditableLink = { export type EditableLink = {
title: string; name: string;
url: string; url: string;
active: boolean; active: boolean;
clicks: number; clicks: number;
@ -56,7 +56,7 @@ const Link: React.FC<LinkProps> = ({ index, link, onChange, onDelete }) => {
type="text" type="text"
placeholder="Edit Title" placeholder="Edit Title"
value={link.title} value={link.title}
onChange={(e) => onChange({ ...link, title: e.target.value })} onChange={(e) => onChange({ ...link, name: e.target.value })}
/> />
<input <input

View File

@ -29,7 +29,7 @@ const Editor: React.FC<EditorProps> = ({ links, setLinks }) => {
setFormState([ setFormState([
...formState, ...formState,
{ {
title: "", name: "",
url: "", url: "",
clicks: 0, clicks: 0,
active: true, active: true,

View File

@ -1,8 +1,8 @@
import React from "react"; import React from "react";
import { useEffect } from "react"; import { useEffect } from "react";
interface Link { export interface Link {
title: string; name: string;
url: string; url: string;
} }
interface LinkProps { interface LinkProps {
@ -36,7 +36,7 @@ const Links: React.FC<LinkProps> = ({ links }) => {
<img className="mb-3" src="csc_logo.png" alt="CSC Logo" width="100px" /> <img className="mb-3" src="csc_logo.png" alt="CSC Logo" width="100px" />
<h1 className="font-bold">@uwcsclub</h1> <h1 className="font-bold">@uwcsclub</h1>
<ul className="flex flex-col my-6 w-full"> <ul className="flex flex-col my-6 w-full">
{links.map(({ title, url }, i) => ( {links.map(({ name, url }, i) => (
<li key={i} className="w-full contents"> <li key={i} className="w-full contents">
<a <a
className="btn bg-gray-450 p-3 text-white font-bold text-center self-center my-1.5 className="btn bg-gray-450 p-3 text-white font-bold text-center self-center my-1.5
@ -47,7 +47,7 @@ const Links: React.FC<LinkProps> = ({ links }) => {
rel="noreferrer" rel="noreferrer"
onClick={handleClick} onClick={handleClick}
> >
{title} {name}
</a> </a>
</li> </li>
))} ))}

View File

@ -15,13 +15,13 @@ export const getStaticProps: GetStaticProps = async () => {
props: { props: {
data: [ data: [
{ {
title: "dummlink1", name: "dummlink1",
url: "www.helloworld.com", url: "www.helloworld.com",
clicks: 0, clicks: 0,
active: true, active: true,
}, },
{ {
title: "dummlink2", name: "dummlink2",
url: "www.hiworld.com", url: "www.hiworld.com",
clicks: 0, clicks: 0,
active: true, active: true,