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
/.vs
/.vscode
/links.json

View File

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

View File

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

View File

@ -1,8 +1,8 @@
import React from "react";
import { useEffect } from "react";
interface Link {
title: string;
export interface Link {
name: string;
url: string;
}
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" />
<h1 className="font-bold">@uwcsclub</h1>
<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">
<a
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"
onClick={handleClick}
>
{title}
{name}
</a>
</li>
))}

View File

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