Add transition to accordion with react + tailwind - reactjs

I tried to copy this code and convert native javascript to React, everything but the transition works (the content suddenly grows but it has no animation)
import { useState } from "react"
import { FaMinus, FaPlus } from "react-icons/fa"
function Accordion({ title, content }: { title: string; content: string }) {
const [expanded, setExpanded] = useState(false)
const toggleExpanded = () => setExpanded((current) => !current)
return (
<div className={`transition hover:bg-indigo-50 ${expanded ? "bg-indigo-50" : "bg-white"}`} onClick={toggleExpanded}>
<div className="accordion-header cursor-pointer transition flex space-x-5 px-5 items-center h-16 select-none">
{expanded ? <FaMinus className="text-indigo-500" /> : <FaPlus className="text-indigo-500" />}
<h3>{title}</h3>
</div>
<div className={`px-5 pt-0 overflow-hidden transition ${expanded ? "max-h-fit" : "max-h-0"}`}>
<p className="leading-6 font-light pl-9 pb-4 text-justify">{content}</p>
</div>
</div>
)
}
function AccordionWrapper() {
return (
<div className="h-screen bg-gradient-to-br from-pink-50 to-indigo-100 grid place-items-center">
<div className="w-6/12 mx-auto rounded border">
<div className="bg-white p-10 shadow-sm">
<h3 className="text-lg font-medium text-gray-800">Several Windows stacked on each other</h3>
<p className="text-sm font-light text-gray-600 my-3">The accordion is a graphical control element comprising a vertically stacked list of items such as labels or thumbnails</p>
<div className="h-1 w-full mx-auto border-b my-5"></div>
<Accordion title="What is term?" content="Our asked sex point her she seems. New plenty she horses parish design you. Stuff sight equal of my woody. Him children bringing goodness suitable she entirely put far daughter." />
</div>
</div>
</div>
)
}

You need more styles that just transition, you will need to add overflow-hidden transition-[max-height] duration-500 ease-in to the div that you want to change it's max-height
Also as explained in this question you can't use max-h-fit, you will need to set a value for it max-h-40
const { useState } = React
const minusIcon = '-'
const plusIcon = '+'
function Accordion({ title, content }) {
const [expanded, setExpanded] = useState(false)
const toggleExpanded = () => setExpanded((current) => !current)
return (
<div className="my-2 sm:my-4 md:my-6 shadow-sm cursor-pointer bg-white" onClick={toggleExpanded}>
<div className="px-6 text-left items-center h-20 select-none flex justify-between flex-row">
<h5 className="flex-1">
{title}
</h5>
<div className="flex-none pl-2">{expanded ? minusIcon : plusIcon}</div>
</div>
<div className={`px-6 pt-0 overflow-hidden transition-[max-height] duration-500 ease-in ${expanded ? "max-h-40" : "max-h-0"}`}>
<p className="pb-4 text-left">
{content}
</p>
</div>
</div>
)
}
const lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
ReactDOM.createRoot(
document.getElementById("root")
).render(
<div className='py-16 md:py-20 lg:py-24 px-4 bg-black'>
<section className="max-w-6xl mx-auto text-center">
<Accordion title="Accordion #1" content={lorem} />
<Accordion title="Accordion #2" content={lorem} />
<Accordion title="Accordion #3" content={lorem} />
</section>
</div>
);
<div id="root"></div>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/react#18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom#18/umd/react-dom.development.js" crossorigin></script>

When you use transition class only that properties transition when they change:
color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter
You should use transition-all class instead of transition.
tailwind docs

Related

Framer Motion animate parent FORM element if form button is clicked

I recently started working with Framer Motion. I really like it, and it makes it a lot easier to animate divs and add page transitions. I am having a problem where I am checking if my form is toggled (open/closed) to animate that parent <form> tag using Framer Motion. <motion.form> However, I am already inside the check if the Toggle is active and this way it's firing and checking for two things the animation and toggle state.
How can I simply animate the form if toggleForm is active?
Parent Article.tsx:
import React, { useState, useCallback } from "react";
import { NextPage } from "next";
import Head from "next/head";
import Link from "next/link";
import VideoModule from "#modules/VideoModule";
import HeroModule from "#modules/HeroModule";
import SliderModule from "#modules/SliderModule";
import ImageModule from "#modules/ImageModule";
import QuoteModule from "#modules/QuoteModule";
import PreFooterModule from "#modules/PreFooterModule";
import Footer from "#components/Footer";
import CommentForm from "#components/CommentForm";
const Article: NextPage = () => {
const closeFormText = "Ik reageer later";
const respondFormText = "Ik wil reageren";
const [buttonText, setButtonText] = useState(respondFormText);
const [toggleForm, setToggleForm] = useState(false);
const onToggleForm = useCallback(() => {
setToggleForm(!toggleForm);
!toggleForm ? setButtonText(closeFormText) : setButtonText(respondFormText);
}, [toggleForm, setToggleForm]);
return (
<>
<Head>
<title>Artikel Detail</title>
<meta name="author" content="" />
<meta name="description" content="Developed by Friends For Brands" />
<link rel="icon" href="/favicon.ico" />
</Head>
<HeroModule
title="De headline van deze tekstuele content"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
/>
<div className="max-w-screen-xl px-6 pt-16 pb-12 mx-auto border-navyBlue border-b-1 lg:px-8 text-navyBlue ">
<div className="grid w-full grid-cols-12 gap-6">
<aside className=" lg:col-span-3 col-span-full">
<div className="grid grid-cols-12 lg:sticky lg:top-5 lg:block">
<div className="col-span-2 mb-4 avatar">
<div className="w-16 h-16 sm:h-20 sm:w-20 md:w-24 md:h-24 rounded-full ring ring-[#65c3c8] ring-offset-base-100 ring-offset-2">
<img src="https://i.pravatar.cc/300" alt="" />
</div>
</div>
<div className="col-span-8 leading-2">
<p className="font-bold">John Doe</p>
<p>Marketing Manager</p>
<p className="mt-2 md:mt-6">00/00/0000</p>
<p>Leestijd 10 minuten</p>
<div className="mt-6 card-actions">
<Link href="/tag/fashion" passHref>
<span className="text-[11px] font-semibold uppercase cursor-pointer badge badge-outline hover:bg-navyBlue hover:text-white">
Fashion
</span>
</Link>
<Link href="/tag/products" passHref>
<span className="text-[11px] font-semibold uppercase cursor-pointer badge badge-outline hover:bg-navyBlue hover:text-white">
Products
</span>
</Link>
</div>
</div>
</div>
</aside>
<main className="leading-relaxed col-span-full lg:col-span-9 md:text-normal">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<h2 className="mt-3 text-3xl md:text-4xl">Koptekst H2</h2>
<h3 className="mt-3 text-2xl md:text-3xl">Koptekst H3</h3>
<h4 className="mt-3 text-xl md:text-2xl">Koptekst H4</h4>
<ul className="pl-6 my-4 list-disc">
<li>Lorem ipsum dolor sit amet</li>
<li>
Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore
</li>
<li>Et dolore magna aliqua. Ut enim ad minim veniam</li>
<li>
Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
</li>
</ul>
<h2 className="mt-6 text-3xl md:text-4xl">Tussentitel</h2>
<ul className="pl-6 my-4 list-decimal">
<li>Lorem ipsum dolor sit amet</li>
<li>
Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore
</li>
<li>Et dolore magna aliqua. Ut enim ad minim veniam</li>
<li>
Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
</li>
</ul>
<h5 className="font-bold">Tussentitel paragraaf</h5>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<h3 className="mt-6 text-2xl md:text-3xl">Video Module</h3>
<React.StrictMode>
<VideoModule id="mkggXE5e2yk" platform="youtube" />
</React.StrictMode>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<h3 className="mt-6 text-2xl md:text-3xl">Image Module</h3>
<ImageModule
url="https://images.pexels.com/photos/1193743/pexels-photo-1193743.jpeg"
caption="Photo of multicolored abstract painting"
alt="A Pexels image"
/>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<h3 className="mt-6 text-2xl md:text-3xl">Slider Module</h3>
<SliderModule />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<h3 className="mt-6 text-2xl md:h2text-3xl">Quote Module</h3>
<QuoteModule />
</main>
</div>
</div>
<CommentForm
buttonText={buttonText}
toggleForm={toggleForm}
clickHandle={onToggleForm}
/>
<PreFooterModule />
<Footer />
</>
);
};
export default Article;
Child component CommentForm.tsx:
import { motion } from "framer-motion";
const variants = {
open: { opacity: 1, x: 0 },
closed: { opacity: 0, x: "-100%" },
}
interface CommentFormProps {
buttonText: string;
toggleForm: boolean;
clickHandle: any;
}
const CommentForm = ({
buttonText,
toggleForm,
clickHandle,
}: CommentFormProps) => (
<div className="w-full max-w-4xl px-4 py-20 mx-auto">
<div className="flex gap-4">
<h2 className="text-2xl md:text-4xl">Reacties</h2>
<button
onClick={clickHandle}
className={`inline-flex px-4 py-2 place-items-center text-xs font-medium uppercase transition duration-150 ease-in-out border rounded-full cursor-pointer border-navyBlue hover:bg-navyBlue hover:text-white md:mt-1`}
>
{buttonText}
</button>
</div>
{toggleForm && (
<motion.form className="pt-8" autoComplete="off" animate {toggleForm ? "open" : "closed"}
variants={variants}>
<div className="grid xl:grid-cols-2 xl:gap-6">
<p className="mb-5 font-bold col-span-full md:m-0">Jouw gegevens</p>
<div className="relative z-0 w-full mb-6">
<input
type="text"
name="first_and_lastname"
id="first_and_lastname"
className="block w-full py-3 text-sm bg-transparent border-0 appearance-none text-navyBlue border-b-1 border-navyBlue focus:outline-none focus:ring-0 focus:border-bubblegum peer"
placeholder=" "
required
/>
<label
htmlFor="first_and_lastname"
className="absolute text-md text-navyBlue duration-200 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-navyBlue peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:uppercase peer-focus:scale-75 peer-focus:-translate-y-6"
>
Voor- en Acthernaam
</label>
</div>
<div className="relative z-0 w-full mb-6">
<input
type="email"
name="email"
className="block w-full py-3 text-sm bg-transparent border-0 appearance-none text-navyBlue border-b-1 border-navyBlue focus:outline-none focus:ring-0 focus:border-bubblegum peer"
placeholder=" "
required
/>
<label
htmlFor="email"
className="absolute text-md text-navyBlue duration-200 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-navyBlue peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:uppercase peer-focus:scale-75 peer-focus:-translate-y-6"
>
E-mailadres
</label>
</div>
</div>
<div className="relative z-0 w-full mt-2 mb-6">
<textarea
id="comment"
name="comment"
rows={5}
className="block w-full py-5 text-3xl bg-transparent border-0 appearance-none resize-none text-navyBlue border-b-1 border-navyBlue focus:outline-none focus:ring-0 focus:border-bubblegum peer"
placeholder=" "
required
/>
<label
htmlFor="comment"
className="absolute text-md text-navyBlue duration-200 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-navyBlue peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:uppercase peer-focus:scale-75 peer-focus:-translate-y-6"
>
Reactie
</label>
</div>
<button
type="submit"
className="items-center justify-center px-6 py-1.5 text-sm font-medium uppercase transition duration-150 ease-in-out bg-transparent border rounded-full shadow-sm md:text-lg text-navyBlue border-navyBlue hover:bg-navyBlue hover:text-white"
>
Reageer op artikel
</button>
</motion.form>
)}
</div>
);
export default CommentForm;
You're using the toggleForm state to change the animate property on the form, but you're also using it to conditionally render the form. So as soon as that state switches to false, the form is removed from the DOM, without having a chance to animate to the "closed" variant.
{toggleForm && (
<motion.form className="pt-8" autoComplete="off" animate {toggleForm ? "open" : "closed"}
variants={variants}>
//...etc
)}
The easiest fix would be remove the conditional rendering, and just use the state to change the animation variant on the motion.form element ("open" or "closed").
If you need to actually remove the form from the DOM like that, you can use AnimatePresence with an exit animation (don't forget to give the form a unique key prop!) to have the the element perform an animation before getting removed from the DOM.

ScrollWidth return ClientWidth instead the currect value

I'm building a slider with React and framer motion. My idea is to subtract scrollWidth with offsetWidth to get the remaining width of the element.
I always get the value of zero (somehow they are equal). I printed the object and I saw that scrollWidth value returns clientWidth instead.
In the object the value of scrollWidth is totaly different and I cant tell why.
I am Creating This Same Project Carousel Slider In Next.js
But I got scrollWidth is Undefined
I dont Know What Happend But..
I got scrollWidth is undefined
enter image description here
import React, { useEffect, useRef, useState } from 'react'
import { motion } from 'framer-motion';
import cardsUser from '../pages/CardsUsers'
const CardCaousel = () => {
const [width,setWidth] = useState(0)
const carousel = useRef()
useEffect(()=>{
setWidth(carousel.current.scrollWidth - carousel.current.offsetWidth)
},[])
return (
<div className="container max-w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-5 bggradient">
<div className="liveactionscontainer mt-20">
<h1 className='text-center text-white font-extralight text-6xl mt-2 mb-3'>Live Actions </h1>
<p className='font-extralight text-gray-500 text-center'>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis, suscipit repellat
<br/>
inventore dolor quia quos molestias quae vitae? Eveniet nobis, laborum voluptas culpa libero similique.</p>
<div className="myflex flex justify-center" data-aos="fade-right">
<motion.div className="carousel">
<motion.div
drag="X"
dragConstraints={{right:0,left:-width}}
className="inner-carousel"
>
{cardsUser.map((e)=>{
return (
<motion.div className='item' key={e}>
<div className="mycolumn mb-10">
<div class="nft">
<div class='main'>
<img class='tokenImage' src={e.Imgsrc} alt="NFT" />
<h2>{e.name}</h2>
<p class='description'>Lorem, ipsum dolor sit amet consectetur adipisicing elit. </p>
<div class='tokenInfo'>
<div class="price">
<ins>◘</ins>
<p>0.031 ETH</p>
</div>
<div class="duration">
<button>Place bid</button>
</div>
</div>
<hr />
<div class='creator'>
<div class='wrapper'>
<img src={e.profileImg} alt="Creator" />
</div>
<p><ins>Creation of</ins><span className='text-white'> NF</span> </p>
</div>
</div>
</div>
</div>
</motion.div>
);})}
</motion.div>
</motion.div>
</div>
</div>
</div>
)
}
export default CardCaousel

TailwindCSS: How can I fix a header & footer to the screen while keeping scrollable content in between?

I'm creating a React PWA for a client using Tailwind CSS and I want to achieve a layout in which there's a header fixed to the top of the screen and a navbar fixed to the bottom of the screen. In between I'll display scrollable content of dynamic size.
I've been struggling with this problem for the most part of the day and I'm following the instructions on this answer as well as the code it provided here.
I though I got it, as I implemented all the recommended classes in the relevant components and I got this result on my browser dev tools:
However, I got curious and decided to open the page on my phone. This is the result there and, as you can see, neither of the desired elements are actually fixed to the screen:
At this point I'm completely lost. I've tried using className={fixed} in the Navbar, but it ends up clipping part of the content even when adding margin or padding to either the navbar or the content.
How can I fix both header and navbar to the screen while keeping the content scrollable?
These are the relevant parts of my code:
App.js:
function App() {
return (
<Router>
<div className='flex flex-col h-screen overflow-hidden'>
<Header></Header>
<div className='MainContent flex-1 overflow-y-scroll py-2 mx-2'>
<Routes>
<Route path="/" element={<OrderView />} />
<Route path="/DeliverymenView" element={<DeliverymenView />} />
<Route path="/InventoryView" element={<InventoryView />} />
<Route path="/RouteGenerationView" element={<RouteGenerationView />} />
<Route path="/AdministrativeView" element={<AdministrativeView />} />
<Route path="*" element={<ErrorView />} />
</Routes>
</div>
<Navbar></Navbar>
</div>
</Router>
);
}
Header.js:
const Header = () => {
return (
<div className="Header shadow-md bg-white w-full ">
<CurrentPage />
</div>
)
}
Navbar.js:
function Navbar() {
return (
<div className="Navbar w-full flex flex-row gap-x-2 justify-evenly py-1 bg-white drop-shadow-md-top">
<Link to="/">
<MdShoppingCart className="text-zinc-400 text-5xl "></MdShoppingCart>
</Link>
<Link to="/DeliverymenView">
<MdPerson className="text-zinc-400 text-5xl "></MdPerson>
</Link>
<Link to="/InventoryView">
<MdViewList className="text-zinc-400 text-5xl "></MdViewList>
</Link>
<Link to="/RouteGenerationView">
<MdDeliveryDining className="text-zinc-400 text-5xl "></MdDeliveryDining>
</Link>
</div>
)
}
One way to keep flex on the parent container is to add sticky to the header and footer divs, with top-0 or bottom-0, like this:
Modified code from the tailwind play linked in your question.
<div class="flex flex-col h-screen">
<header class="w-full text-center border-b border-grey p-4 sticky top-0">Some header</header>
<main class="flex-1 overflow-y-scroll">
<div class="min-h-screen bg-slate-100">
<p>This is a very long section that consumes 100% viewport height!</p>
</div>
<div class="min-h-screen bg-slate-200">
<p>This is second long section that consumes 100% viewport height!</p>
</div>
<div class="min-h-screen bg-slate-100">
<p>This is third long section that consumes 100% viewport height!</p>
</div>
<div class="min-h-screen bg-slate-200">
<p>This is fourth long section that consumes 100% viewport height!</p>
</div>
<div class="min-h-screen bg-slate-100">
<p>This is fifth long section that consumes 100% viewport height!</p>
</div>
</main>
<footer class="w-full text-center border-t border-grey p-4 sticky bottom-0">some footer</footer>
</div>
Actually you don't need to set the position to "fixed" or "absolut". The problem can be solved simpler.
You need 4 divs. One as a container (we can call its class "root") which contains the further 3 divs.
For defining how much space each inner div can take from the root div we can use "flex" (with "flex" you can define the proportion to other components).
(You can of course change height and width of root as you like)
.root {
height: 70vh;
width: 50vw;
display: flex;
flex-direction: column;
justify-content: stretch;
}
.Header--container {
flex: 1;
background-color: green;
}
.Footer--container {
flex: 1;
background-color: red;
}
.Content--container {
flex: 5;
background-color: white;
overflow-y: scroll;
}
<div class="root">
<div class="Header--container">
</div>
<div class="Content--container">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div>
<div class="Footer--container">
</div>
</div>

How to check if user input exists in database in a Blazor Server app?

I'm creating a Blazor Server project with login and I want to check if the email and password that the user introduces exists in the database(I'm using Sql Server). I created my method that is searching in the database in a class named BatranService and my login form in a Razor component, but I'm not sure how the code to connect these two would look like. I would appreciate any help, thanks!
public class BatranService : IBatranService
{
private readonly VoluntariatDBContext _context;
public BatranService(VoluntariatDBContext context)
{
_context = context;
}
public async Task<Batran> GetBatranByEmailAndParola(string email, string parola)
{
Batran batran = await _context.Batrans.Where(c=>c.Parola==parola).FirstOrDefaultAsync(c => c.Email == email);
return batran;
}
}
<EditForm Model="#batran" OnValidSubmit="#authBatran">
<div class="container px-4 py-5 mx-auto">
<div class="card card0">
<div class="d-flex flex-lg-row flex-column-reverse">
<div class="card card1">
<div class="row justify-content-center my-auto">
<div class="col-md-8 col-10 my-5">
<div class="row justify-content-center px-3 mb-3"> <img id="logo" src="css/autentificareLogo.png"> </div>
<h3 class="mb-5 text-center heading">Autentificare</h3>
<div class="form-group"> <label class="form-control-label text-muted">Email</label> <input type="text" id="email" #bind-value="#batran.Email" name="email" placeholder="Email" class="form-control"> </div>
<div class="form-group"> <label class="form-control-label text-muted">Parola</label> <input type="password" id="parola" #bind-value="#batran.Parola" name="parola" placeholder="Parola" class="form-control"> </div>
<div class="row justify-content-center my-3 px-3"> <button #onclick="authBatran" class="btn-block btn-color">Intra in cont</button> </div>
<div class="row justify-content-center my-2"> <small class="text-muted">Ai uitat parola?</small> </div>
</div>
</div>
<div class="bottom text-center mb-5">
<p href="#" class="sm-text mx-auto mb-3">Nu ai un cont?<button #onclick="deschideInregistrare" class="btn btn-white ml-2">Inregistreaza-te acum!</button></p>
</div>
<div class="col-12 row" style="text-align:left; font-weight:bold">
<span class="col-12"></span>
</div>
</div>
<div class="card card2">
<div class="my-auto mx-md-5 px-md-5 right">
<h4 class="text-white">We are more than just a company</h4> <small class="text-white">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</small>
</div>
</div>
</div>
</div>
</div>
</EditForm>
#code{
private void authBatran()
{
}
}

React.js / Next.js - how to link from one article to another?

Suppose this example with two articles (full example here https://github.com/codebushi/nextjs-starter-dimension/blob/master/components/Main.js)
import PropTypes from 'prop-types';
class Main extends React.Component {
render() {
let close = <div className="close" onClick={() => {this.props.onCloseArticle()}}></div>
return (
<div id="main" style={this.props.timeout ? {display: 'flex'} : {display: 'none'}}>
<article id="intro" className={`${this.props.article === 'intro' ? 'active' : ''} ${this.props.articleTimeout ? 'timeout' : ''}`} style={{display:'none'}}>
<h2 className="major">Intro</h2>
<span className="image main"><img src="/static/images/pic01.jpg" alt="" /></span>
<p>Nam maximus erat id euismod egestas. By the way, check out my awesome work.</p>
{close}
</article>
<article id="work" className={`${this.props.article === 'work' ? 'active' : ''} ${this.props.articleTimeout ? 'timeout' : ''}`} style={{display:'none'}}>
<h2 className="major">Work</h2>
<span className="image main"><img src="/static/images/pic02.jpg" alt="" /></span>
<p>Adipiscing magna sed dolor elit. Praesent eleifend dignissim arcu, at eleifend sapien imperdiet ac. Aliquam erat volutpat. Praesent urna nisi, fringila lorem et vehicula lacinia quam. Integer sollicitudin mauris nec lorem luctus ultrices.</p>
{close}
</article>
</div>
)
}
}
Main.propTypes = {
route: PropTypes.object,
article: PropTypes.string,
articleTimeout: PropTypes.bool,
onCloseArticle: PropTypes.func,
timeout: PropTypes.bool
}
export default Main
How do I create a link in the intro article to open the work article? In the example there's an <a href='#work'>, but when I click it there's no action at all.
You can do it by importing 'Link' from Next.js:
import Link from "next/link";
Then you can add:
<Link href="work">
<a>Go To Work!</a>
</Link>
Full documentation from Next.js: https://nextjs.org/docs/api-reference/next/link

Resources