How to make cards slide in React using buttons? - reactjs

I want buttons to slide different cards on the screen currently it is moving by clicking on cards.
I tried using jquery ComponentDidMount but I'm unable to make it work and I'm stucked here.
this is my code In App class
<div className="flex flex-wrap sm:-m-4 -mx-4 -mb-10 -mt-4">
<div className="md:w-1/4 py-64 md:mb-0 mb-6 flex flex-col text-center items-center">
<div className="w-20 h-20 inline-flex items-center justify-center rounded-full bg-orange-100 text-orange-500 mb-5 flex-shrink-0">
<img
id="pre-btn"
alt="logo"
className="h-10 pr-0"
src={back}
></img>
</div>
</div>
<div className="md:w-2/4 md:mb-0 mb-6 flex flex-col text-center items-center">
<section
id="slider"
className="w-16 h-20 inline-flex items-center justify-center mb-5 flex-shrink-0"
>
<input type="radio" name="slider" id="s1" defaultChecked="false"/>
<input type="radio" name="slider" id="s2" defaultChecked="true"/>
<input type="radio" name="slider" id="s3" defaultChecked="false"/>
<label htmlFor="s1" id="slide1">
{/* <img className="fea" src="./assets/img/img1.jpg" height="100%" width="100%"/> */}
</label>
<label htmlFor="s2" id="slide2">
{/* <img className="fea" src="./assets/img/img2.jpg" height="100%" width="100%"/> */}
</label>
<label htmlFor="s3" id="slide3">
{/* <img className="fea" src="./assets/img/img3.jpg" height="100%" width="100%"/> */}
</label>
</section>
</div>
<div className="md:w-1/4 py-64 md:mb-0 mb-6 flex flex-col text-center items-center">
<div className="w-20 h-20 inline-flex items-center justify-center rounded-full bg-orange-100 text-orange-500 mb-5 flex-shrink-0">
<img
id="nex-btn"
alt="logo"
className="h-10 pr-0"
src={front}
></img>
</div>
</div>
</div>
this is my css part
[type=radio] {
display: none;
}
#slider {
height: 30vw;
width: 40vw;
margin: 0 auto;
left: -10%;
position: relative;
perspective: 1000px;
transform-style: preserve-3d;
}
#slider label {
margin: auto;
background-color: aliceblue;
width: 60%;
height: 100%;
border-radius: 4px;
position: absolute;
left: 0; right: 0;
cursor: pointer;
transition: transform 0.4s ease;
}
#s1:checked ~ #slide3, #s2:checked ~ #slide1,
#s3:checked ~ #slide2 {
box-shadow: 0 6px 10px 0 rgba(0,0,0,.3), 0 2px 2px 0 rgba(0,0,0,.2);
transform: translate3d(-50%,0,-100px);
}
#s1:checked ~ #slide1, #s2:checked ~ #slide2,
#s3:checked ~ #slide3 {
box-shadow: 0 13px 25px 0 rgba(0,0,0,.3), 0 11px 7px 0 rgba(0,0,0,.19);
transform: translate3d(0,0,0);
}
#s1:checked ~ #slide2, #s2:checked ~ #slide3,
#s3:checked ~ #slide1 {
box-shadow: 0 6px 10px 0 rgba(0,0,0,.3), 0 2px 2px 0 rgba(0,0,0,.2);
transform: translate3d(50%,0,-100px);
}
this is my jquery code
componentDidMount() {
var i=Number(2) ;
var dam = "#s" + i ;
$("#pre-btn").click(function(){
// console.log(dam);
$(dam).prop('defaultChecked', "false") ;
if(i>1){
i-- ;
}
$(dam).prop('defaultChecked', "true") ;
}) ;
$("#nex-btn").click(function(){
$(dam).prop('defaultChecked', "false") ;
if(i<3){
i++ ;
}
$(dam).prop('defaultChecked', "true") ;
}) ;
}
I think that states in react must be used but I don't know how to use that's why I used jquery.

Here is what i can propose you, without jquery (I usually try to avoid it) :
import React, { Component } from "react";
import { render } from "react-dom";
import Hello from "./Hello";
import "./style.css";
const App = () => {
const [selectedIndex, setSelectedIndex] = React.useState(0);
const checkNext = () => {
const labels = document.querySelectorAll('#slider label');
const nextIndex = selectedIndex === (labels.length - 1) ? 0 : selectedIndex + 1;
setSelectedIndex(nextIndex);
}
const check = index => setSelectedIndex(index);
return (
<div>
<div className="flex flex-wrap sm:-m-4 -mx-4 -mb-10 -mt-4">
<div className="md:w-1/4 py-64 md:mb-0 mb-6 flex flex-col text-center items-center">
<div className="w-20 h-20 inline-flex items-center justify-center rounded-full bg-orange-100 text-orange-500 mb-5 flex-shrink-0">
<button onClick={checkNext}>{'<'}</button>
</div>
</div>
<div className="md:w-2/4 md:mb-0 mb-6 flex flex-col text-center items-center">
<section
id="slider"
className="w-16 h-20 inline-flex items-center justify-center mb-5 flex-shrink-0"
>
<input
type="radio"
name="slider"
id="s1"
checked={selectedIndex === 0}
onClick={() => check(0)}
/>
<input
type="radio"
name="slider"
id="s2"
checked={selectedIndex === 1}
onClick={() => check(1)}
/>
<input
type="radio"
name="slider"
id="s3"
checked={selectedIndex === 2}
onClick={() => check(2)}
/>
<label htmlFor="s1" id="slide1">
<img className="fea" src="https://picsum.photos/200/200" height="100%" width="100%"/>
</label>
<label htmlFor="s2" id="slide2">
<img className="fea" src="https://picsum.photos/200/300" height="100%" width="100%"/>
</label>
<label htmlFor="s3" id="slide3">
<img className="fea" src="https://picsum.photos/300/300" height="100%" width="100%"/>
</label>
</section>
</div>
<div className="md:w-1/4 py-64 md:mb-0 mb-6 flex flex-col text-center items-center">
<div className="w-20 h-20 inline-flex items-center justify-center rounded-full bg-orange-100 text-orange-500 mb-5 flex-shrink-0">
<button onClick={checkNext}>{'>'}</button>
</div>
</div>
</div>
</div>
);
}
render(<App />, document.getElementById("root"));
I didn't change your css at all and used it to do the switch, as before. I just created a state containing the index of the checked element, which allow you to defined wether or not an input is checked. When the value changes, it trigger your css and do the switch.
Here is a repro on stackblitz.

Related

Tailwind CSS layout loses background

Using h-screen works until my datepicker comes up which expands the viewport
How do I make the background still fill (once a date box is hovered on it pops up the date picker)? The white space at the bottom of the date picker is the problem. I have a sidebar component for left-hand nav and a main content area.
Main content code:
.main-content {
#apply p-6 h-screen w-screen flex flex-col bg-slate-800 shadow-lg m-0 text-white;
}
Sidebar css:
.sidebar {
#apply h-screen w-20 flex flex-col bg-gray-900 shadow-lg m-0 px-3;
}
Datepicker code:
<div className="flex datepicker group-hover:scale-100 z-10">
<div className="grid grid-col-7 w-64 bg-gray-700 p-2 rounded-lg shadow-xl">
<div className="sub-text text-center">
{DateValue.monthLong} {DateValue.year}
<span
className="m-2 px-2 py-1 bg-gray-700 rounded-3xl hover:bg-gray-900 cursor-pointer"
onClick={(e) => changeMonth(e, false)}
>
<
</span>
<span
className="px-2 py-1 bg-gray-700 rounded-3xl hover:bg-gray-900 cursor-pointer"
onClick={(e) => changeMonth(e, true)}
>
>
</span>
</div>
<hr className="mb-2" />
<div className="grid grid-cols-7 pb-2">
<div className="text-center">Su</div>
<div className="text-center">Mo</div>
<div className="text-center">Tu</div>
<div className="text-center">We</div>
<div className="text-center">Th</div>
<div className="text-center">Fr</div>
<div className="text-center">Sa</div>
</div>
<div className="grid grid-cols-7">{daysAsInput()}</div>
</div>
</div>
CSS (Tailwind Apply)
.datepicker {
#apply absolute transition-all duration-100 scale-0;
}
.datepicker-day {
#apply m-1 bg-gray-700 rounded-lg shadow-lg
cursor-pointer items-center justify-center
p-1 text-sky-400 hover:bg-gray-900;
}
It scales to 100 when the input is hovered over.
Layout code:
<div className="flex">
<Sidebar />
<div className="main-content min-h-screen">{children}</div>
</div>
daysAsInput code:
const daysAsInput = () => {
// loop through the days in the month but start at the first day of the week
const inputs = [];
for (
let i = firstDayOfMonthAligned.day;
i <= firstDayOfMonthAligned.daysInMonth;
i++
) {
// create input that's grayed out if it's not in the current month
inputs.push(
<input
key={'previousMonth ' + i}
className="datepicker-day disabled:text-gray-400"
type="button"
value={i}
disabled={true}
onClick={dateChanged}
/>
);
}
for (let i = 1; i <= daysInMonth; i++) {
inputs.push(
<input
className="datepicker-day"
key={i}
type="button"
name="day {i}"
value={i}
onClick={dateChanged}
/>
);
}
return inputs;
};
The problem is caused by the fact that you position the datepicker absolute.
From the docs:
The element is removed from the normal document flow, and no space is
created for the element in the page layout.
You must take another approach, probably with z-index or javascript.
Try to change it to min-h-screen . That should do the magic
I think the problem is, we need to adjust the height styling of main-content class.
We can add "min-h-full" to the main-content class,
.main-content {
#apply p-6 h-screen w-screen flex flex-col bg-slate-800 shadow-lg m-0 text-white min-h-full;
}
This tailwind class will adjust the height of main-content to 100%. And the white background, have no room anymore.
Here was the reference of min-height
Thank you

Display divs one above the other

import React from "react";
export default function Example() {
return (
<div>
<div
className="grid"
style={{
gridTemplateColumns: "1.75rem repeat(288, minmax(0, 1fr)) auto",
}}
>
<div
className="mt-px inline-grid grid-cols-1 sm:col-start-3"
style={{ gridColumn: "74 / span 12" }}
>
<a href="#" className="rounded-lg bg-blue-50 p-2 text-xs">
<p className="order-1 font-semibold text-blue-700">Breakfast</p>
<p className="text-blue-500 group-hover:text-blue-700">
<time dateTime="2022-01-12T06:00">6:00 AM</time>
</p>
</a>
</div>
<div
className="mt-px inline-grid grid-cols-1 sm:col-start-3"
style={{ gridColumn: "76 / span 12" }}
>
<a href="#" className="rounded-lg bg-blue-50 p-2 text-xs">
<p className="order-1 font-semibold text-blue-700">Breakfast</p>
<p className="text-blue-500 group-hover:text-blue-700">
<time dateTime="2022-01-12T06:00">6:30 AM</time>
</p>
</a>
</div>
</div>
</div>
);
}
If you want both the tiles over one another , add absolute w-1/4 right-4 class to both the divs.
import React from "react";
export default function Example() {
return (
<div>
<div
className="grid"
style={{
gridTemplateColumns: "1.75rem repeat(288, minmax(0, 1fr)) auto",
}}
>
<div
className="absolute w-1/4 right-4 mt-px inline-grid grid-cols-1 sm:col-start-3"
style={{ gridColumn: "74 / span 12" }}
>
<a href="#" className="rounded-lg bg-blue-50 p-2 text-xs">
<p className="order-1 font-semibold text-blue-700">Breakfast</p>
<p className="text-blue-500 group-hover:text-blue-700">
<time dateTime="2022-01-12T06:00">6:00 AM</time>
</p>
</a>
</div>
<div
className="absolute w-1/4 right-4 mt-px inline-grid grid-cols-1 sm:col-start-3"
style={{ gridColumn: "76 / span 12" }}
>
<a href="#" className="rounded-lg bg-blue-50 p-2 text-xs">
<p className="order-1 font-semibold text-blue-700">Breakfast</p>
<p className="text-blue-500 group-hover:text-blue-700">
<time dateTime="2022-01-12T06:00">6:30 AM</time>
</p>
</a>
</div>
</div>
</div>
);
}
you can adjust right and width as per your requirement .

Issue with tailwind, how to prevent w-0 letting a modal overflow from the page?

I have an issue where I created a modal that slide from right to left, but and as soon as I use width 0:
<div
className={`flex flex-col absolute right-0 top-0 h-full min-h-screen transition-width ease-in-out duration-300"
${showModal ? 'w-144' : 'w-0'}
`}
>
The modal overflow the main page as shown here below:
This is my component:
import React from 'react';
interface ModalProps {
showModal: boolean;
setShowModal: React.Dispatch<React.SetStateAction<boolean>>;
}
const Modal = ({ showModal, setShowModal }: ModalProps) => {
const toggleExpand = () => {
setShowModal(!showModal);
};
return (
<div
className={`flex flex-col absolute right-0 top-0 h-full min-h-screen transition-width ease-in-out duration-300"
${showModal ? 'w-144' : 'w-0'}
`}
>
<div className="bg-inpay-green-700 h-20 flex items-center justify-between text-white">
<div className="flex justify-between items-start ml-3">
<div className="flex flex-col items-start mx-3">
<p className="text-xs right-0">payouts</p>
<h3>Customer</h3>
</div>
<div className="flex flex-col items-start mx-3">
<p className="text-xs right-0">payouts</p>
<h3>Customer</h3>
</div>
<div className="flex flex-col items-start mx-3">
<p className="text-xs right-0">payouts</p>
<h3>Customer</h3>
</div>
</div>
<div className="flex items-center mr-3">
<div className="flex flex-col items-end mx-3">
<p className="text-xs right-0">EUR</p>
<h3>50.00</h3>
</div>
<a onClick={toggleExpand} className=" w-4 h-4 block top-8 mx-3">
<svg
xmlns="http://www.w3.org/2000/svg"
width="19.536"
height="19.536"
viewBox="0 0 19.536 19.536"
>
<g
id="Group_6419"
data-name="Group 6419"
transform="translate(1.768 1.768)"
>
<path
id="Path_9699"
data-name="Path 9699"
d="M1.25,17.248l16-16"
transform="translate(-1.25 -1.248)"
fill="none"
stroke="#fff"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2.5"
/>
<path
id="Path_9700"
data-name="Path 9700"
d="M17.25,17.248l-16-16"
transform="translate(-1.25 -1.248)"
fill="none"
stroke="#fff"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2.5"
/>
</g>
</svg>
</a>
</div>
</div>
<div className="bg-white h-full text-black flex justify-between overflow-hidden p-6 border border-inpay-black-haze-500">
<div className="border border-inpay-black-haze-500 bg-inpay-black-haze-100 w-2/4">
<p>TEST</p>
</div>
<div className="h-full w-2/4 ml-6">
<div className="border border-inpay-black-haze-500 bg-inpay-black-haze-100 mb-6 h-40">
<p>TEST</p>
</div>
<div className="border border-inpay-black-haze-500 bg-inpay-black-haze-100 mb-6 h-44">
<p>TEST</p>
</div>
<div className="border border-inpay-black-haze-500 bg-inpay-black-haze-100 h-96">
<p>TEST</p>
</div>
</div>
</div>
</div>
);
};
export default Modal;
I also tried to put overflow hidden on the parent as well as on the modal or use transition but nothing worked.
First, w-144 and transition-width are not a default class in Tailwind, you should add it in the configuration if you haven't. If that does not solve the problem, you can replace width class to max width and apply transition effect on it. It is the same trick that applies to transit the height property.
Example
<div
className={`overflow-hidden w-full flex flex-col absolute right-0 top-0 h-full min-h-screen transition-all ease-in-out duration-300"
${showModal ? 'max-w-7xl' : 'max-w-0'}
`}
>

Single Product View Modal Not Working on React Typescript Project

I am trying to display single product data by fetching it from the server, but there's an issue while opening the modal. If I map, I get a double modal and a blank black screen. How do I get a single product view?
import React, { useState } from "react";
// Import Swiper React components
import { Swiper, SwiperSlide } from "swiper/react";
import { FreeMode, Navigation, Thumbs } from "swiper";
// Import Swiper styles
import "swiper/css";
import "swiper/css/free-mode";
import "swiper/css/navigation";
import "swiper/css/thumbs";
import { Link } from 'react-router-dom';
import { Rating } from "#mui/material";
const ProductView = ({product}) => {
const { title, hoverImg, img, price, rating,vendorName, salePrice } = product;
const [thumbsSwiper, setThumbsSwiper] = useState(null);
return (
<div style={{backgroundColor:'white',width:'800px',height:'600px',overflow:'scroll'}} className='mx-auto container place-content-center px-12 py-8 justify-center items-center grid lg:grid-cols-2 md:grid-cols-2 grid-cols-1 gap-6 sm:flex-1'>
<div>
<Swiper
style={{
"--swiper-navigation-color": "#fff",
"--swiper-pagination-color": "#fff",
}}
spaceBetween={10}
// navigation={true}
thumbs={{ swiper: thumbsSwiper }}
modules={[FreeMode, Navigation, Thumbs]}
className="mySwiper2"
>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={hoverImg} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={hoverImg} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
</Swiper>
<Swiper
onSwiper={setThumbsSwiper}
spaceBetween={10}
slidesPerView={4}
freeMode={true}
watchSlidesProgress={true}
modules={[FreeMode, Navigation, Thumbs]}
className="mySwiper"
>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={hoverImg} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={hoverImg} />
</SwiperSlide>
<SwiperSlide>
<img alt="" src={img} />
</SwiperSlide>
</Swiper>
</div>
<div>
<h2 className='text-3xl mb-2 font-medium'>{title}</h2>
<div className='flex items-center mb-4'>
<div>
<Rating name="half-rating-read" defaultValue={rating} precision={0.5} readOnly />
</div>
<div className="text-xs text-gray-500 ml-3">
(1 Reviews)
</div>
</div>
<div className='space-y-2'>
<p className="p text-gray-800 font-semibold space-x-2">
<span>Availability:</span>
<span className='text-green-600'>In stock</span>
</p>
<p className="space-x-2">
<span className='text-gray-800 font-semibold'>Vendor:</span>
<span className='text-gray-600'>{vendorName}</span>
</p>
<p className="space-x-2">
<span className='text-gray-800 font-semibold'>Category:</span>
<span className='text-gray-600'>Men</span>
</p>
<p className="space-x-2">
<span className='text-gray-800 font-semibold'>SKU:</span>
{/* <span className='text-gray-600 uppercase'>{_id.slice(4,12)}</span> */}
</p>
</div>
<div className="flex items-baseline mb-1 mt-2 space-x-2">
<p className="text-xl text-indigo-500 font-semibold">{salePrice}</p>
<p className="text-sm text-gray-400 line-through">{price}</p>
</div>
<div className="">
<h3 className="text-xl text-gray-800 mb-3 uppercase font-medium ">Color</h3>
<div className="flex gap-2">
{/* Single Color Starts */}
<div className="color-selctor">
<input type="radio" name='color' className='hidden' color='red' id='color-red' />
<label htmlFor="color" className='border border-gray-200 rounded-sm h-5 w-5 cursor-pointer shadow-sm block' style={{ backgroundColor: "red" }}></label>
</div>
<div className="color-selctor">
<input type="radio" name='color' className='hidden' color='red' id='color-red' />
<label htmlFor="color" className='border border-gray-200 rounded-sm h-5 w-5 cursor-pointer shadow-sm block' style={{ backgroundColor: "green" }}></label>
</div>
<div className="color-selctor">
<input type="radio" name='color' className='hidden' color='red' id='color-red' />
<label htmlFor="color" className='border border-gray-200 rounded-sm h-5 w-5 cursor-pointer shadow-sm block' style={{ backgroundColor: "blue" }}></label>
</div>
</div>
</div>
<div className="pt-4 block">
<h3 className="text-xl text-gray-800 mb-3 uppercase font-medium">Size</h3>
<div className="flex item-center gap-2">
{/* single size selector starts */}
<div className="size-selector">
<input type="radio" name='size' className='hidden' id='xs' />
<label htmlFor="size-xs" className='text-xs border border-gray-200 rounded-sm h-6 w-6 flex items-center justify-center cursor-pointer shadow-sm text-gray-600'>
S
</label>
</div>
<div className="size-selector">
<input type="radio" name='size' className='hidden' id='xs' />
<label htmlFor="size-xs" className='text-xs border border-gray-200 rounded-sm h-6 w-6 flex items-center justify-center cursor-pointer shadow-sm text-gray-600'>
M
</label>
</div>
<div className="size-selector">
<input type="radio" name='size' className='hidden' id='xs' />
<label htmlFor="size-xs" className='text-xs border border-gray-200 rounded-sm h-6 w-6 flex items-center justify-center cursor-pointer shadow-sm text-gray-600'>
L
</label>
</div>
<div className="size-selector">
<input type="radio" name='size' className='hidden' id='xs' />
<label htmlFor="size-xs" className='text-xs border border-gray-200 rounded-sm h-6 w-6 flex items-center justify-center cursor-pointer shadow-sm text-gray-600'>
XS
</label>
</div>
</div>
</div>
<div>
<h3 className='text-xl text-gray-800 mb-1'>Quantity</h3>
<div className="flex border border-gray-500 divide-gray-500 text-gray-600 divide-x w-max">
<div className='h-8 w-8 flex items-center justify-center cursor-pointer select-none'>
-
</div>
<div className='h-8 w-8 flex items-center justify-center'>
<input style={{width:'34px',height:'34px'}} type="text" />
</div>
<div className='h-8 w-8 flex items-center justify-center cursor-pointer select-none'>
+
</div>
</div>
</div>
<div className="flex gap-3 border-b border-gray-200 pb-5 mt-6">
<Link to = "/">
<button className='text-center top-5 text-white p-2 bg-indigo-500 border border-indigo-500 hover:bg-transparent hover:text-indigo-500 transition'>
<i className="fa-regular fa-bag-shopping"></i> Add to cart
</button>
</Link>
<Link to = "/">
<button className='text-center top-5 hover:text-white p-2 hover:bg-indigo-500 border border-indigo-500 bg-transparent text-indigo-500 transition'>
<i className="fa-regular fa-heart"></i> Add to Wishlist
</button>
</Link>
</div>
</div>
</div>
);
};
export default ProductView;

media query not working int the below code - Recact js

In the below code the media query not working. Please help if any mistake I did.
I used paragraph media query the below. When I checked in mobile mode t is not working.
/* eslint-disable react/jsx-no-target-blank /
/ eslint-disable react/no-unescaped-entities */
import React from 'react'
import { DropdownButton, Dropdown } from 'react-bootstrap'
const ProfileInfo = () => {
const paragraph = {
position: 'absolute',
top: '66px',
right: '108px',
'#media screen and (min-width: 610px)': {
position: 'static'
}
}
return (
<div className="container-fluid">
<div className="row clearfix">
<div className="col-md-6 col-sm-12"> </div>
<div className="col-md-6 col-sm-12"> </div>
</div>
<div className="row" style={{ margin: 'auto', width: '50%' }}>
<div className="alert alert-success col-md-12 col-sm-12">
<h5 className="alert-heading">Aktive meldinger</h5>
<p>
Hahahahahhhhhfgdfgf gdfgdfgffgdfggfhgh fgdfgdfgfgfg
</p>
</div>
</div>
<div className="row clearfix">
<div className="col-md-6 col-sm-12">
<div className="card mb-3 shadow-sm p-3 bg-white rounded" >
<h5 className="card-title" style={{ color: '#009540' }}><strong>Profile: </strong> </h5>
<p className="card-text"><strong>Navn: </strong> Bengt Nilsfors</p>
<p className="card-text"><strong>Kontaktinformasjon: </strong> 95833897, nilsfors#gmail.com</p>
<DropdownButton id="dropdown-basic-button" variant="outline-primary"
title="Address">
<Dropdown.Item href="#/action-1">Address1 </Dropdown.Item>
<Dropdown.Item href="#/action-2">Address2</Dropdown.Item>
<Dropdown.Item href="#/action-3">Address3</Dropdown.Item>
</DropdownButton>
<p className="card-text"><strong>Adresse: </strong> Nøkken 7 H0101, 9016 Tromsø</p>
<p className="card-text"><strong>Passord: </strong> ***********</p>
<button className="btn btn-success">Rediger</button>
</div>
</div>
<div className="col-md-6 col-sm-12">
<div className="card mb-3 shadow-sm p-3 bg-white rounded" >
<h5 className="card-title" style={{ color: '#009540' }} ><strong>Nettverksanalyse</strong></h5>
<img className="card-img" variant="top" src="../images/testimg.png" style={{ width: '152px' }} />
<div style= { paragraph }>17:58:55: Henter nettverskinfo...<br/>
18:00:31: Nettverkstatus ok. Ingen feil funnet.</div>
<button className="btn btn-warning mt-2 text-center">See details</button>
</div>
</div>
</div>
<div className="row">
<div className="col-md-4 mt-5 text-center">
<div className="card mb-3 shadow-sm p-3 bg-white rounded" >
<div className="card-body">
<h5 className="card-title" style={{ color: '#009540' }}>Abonnement</h5>
<p className="card-text"><strong>Internett</strong></p>
<p className="card-text">Giga (1000/1000) Kr 699,- per mnd.</p>
Oppgrader
</div>
</div>
</div>
<div className="col-md-4 mt-5 text-center">
<div className="card mb-3 shadow-sm p-3 bg-white rounded">
<div className="card-body">
<h5 className="card-title" style={{ color: '#009540' }}>Faktura</h5>
<ul className="list-group" style= {{ float: 'left' }}>
<li><a className="card-link" href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}>Mars 2021</a></li>
<li><a className="card-link" href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}>Desember 2020</a></li>
<li><a className="card-link"href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}>Februar 2021</a></li>
</ul><ul className="list-group" style={{ float: 'right' }}>
<li><a className="card-link" href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}>Desember 2020</a></li>
<li><a className="card-link" href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}> November 2020</a></li>
<li><a className="card-link" href="https://www.homenet.no/" target="_blank" style={{ color: '#009540' }}>Oktober 2020</a></li>
</ul>
<div style={{ marginTop: '76px' }}> Se alle</div>
</div>
</div>
</div>
<div className="col-md-4 mt-5 text-center">
<div className="card mb-3 shadow-sm p-3 bg-white rounded">
<div className="card-body">
<h5 className="card-title" style={{ color: '#009540' }}>Kontakt oss</h5>
<p className="card-text">Kontakt oss via chat eller telefon 38 99 01 00.</p>
Chat
</div>
</div>
</div>
</div>
</div>
)
}
export default ProfileInfo
t's not the problem with react its with the CSS code. If you apply two rules that collide to the same elements, it will choose the last one that was declared. So put the #media queries to the end of the CSS page. i.e
.footer
.column
.social-column-container
.logo {
width: 100px;
height: auto;
display: inline-block;
margin-left: 50px;
}
#media only screen and (min-width: 900px) {
.footer
.column
.social-column-container
.logo {
display: none;
}
}

Resources