Is there any way to force wrap a single flexbox item onto a new line? If not, what would be a better approach?

I want to force a single flex-box item to wrap on a new row whilst keeping the other items on that row. If this is not possible, is there a better approach without modifying the html too much? I just dont want to mess up the mobile and desktop versions of this website because the tablet version is the one that is messed up right now. Basically, I want to have the list of links expand below the navbar in the tablet version exactly like the mobile version, but keeping everything else on the first row. Thank you so much!

I tried forcing the nav__list item to go on a new row while keeping the logo, menu icon, and buttons on the first row by using flexbox, however, I couldnt figure out anything that worked. The javascript file is just handling the collapsible animation. You can ignore it for now. Also, don’t worry about the styling for the buttons or the section element, they are not really important to solve this problem. This is my code for this section:

CSS:

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 2.4rem;
}

.nav__list {
  width: 100%;
  margin: 0;
}

.nav__item:first-child {
  padding-top: 3.4rem;
}

.nav__item {
  padding-bottom: 2rem;
}

.nav .btn {
  display: none;
}

.nav__item > a {
  color: #000;
  transition: color 0.3s;
}

.nav__item > a:hover {
  color: var(--color-primary);
}

.nav__toggler {
  transition: box-shadow 0.2s;
}

.nav__brand {
  transform: translateY(3px);
}

.nav.collapsible--expanded .nav__toggler {
  box-shadow: 0 0 0 3px #666;
}

@media screen and (min-width: 768px) {
  .nav {
    flex-wrap: nowrap;
  }
  .nav__toggler {
    display: flex;
    order: 3;
    margin-left: 1.2rem;
  }

  .nav .btn {
    display: inline-block;
    padding: 1.4rem 2.4rem;
    margin: 0;
  }

  .nav .btn--white {
    margin-right: 1.6rem;
  }

  .nav__list {
    margin-left: 2.4rem;
  }
}

@media screen and (min-width: 1024px) {
  .nav__toggler {
    display: none;
  }

  .nav__list {
    display: flex;
    width: auto;
    max-height: 100%;
    opacity: 1;
    margin-right: auto;
    margin-left: 2.4rem;
  }

  .nav__item:first-child {
    padding-top: 0;
  }

  .nav__item {
    padding-right: 2.4rem;
    padding-bottom: 0;
  }

  .nav .btn {
    display: flex;
    padding: 1.4rem 2.4rem;
    margin: 0;
  }

  .nav .btn--white {
    margin-right: 2.4rem;
  }
}

HTML:

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Flaming Patty</title>
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="../css/normalize.css" />
    <link rel="stylesheet" href="../css/styles.css" />
  </head>
  <body>
    <nav class="nav collapsible">
      <a class="nav__brand" href="/"><img src="../images/logo.svg" alt="" /></a>
      <span
        class="icon-container icon-container--menu nav__toggler"
        style="flex-shrink: 0"
      >
        <svg class="icon--menu">
          <use href="../images/sprite.svg#menu"></use>
        </svg>
      </span>
      <ul class="list nav__list collapsible__content">
        <li class="nav__item"><a href="#">Home</a></li>
        <li class="nav__item"><a href="#">About</a></li>
        <li class="nav__item"><a href="#">Menu</a></li>
        <li class="nav__item"><a href="#">Contact</a></li>
        <li class="nav__item"><a href="#">Delivery</a></li>
      </ul>
      <button class="btn btn--white">Order online</button>
      <button class="btn btn--primary">Reserve</button>
    </nav>
    <section class="block block--orange">
      <header class="block__header">
        <h2 class="block__heading">Heading</h2>
        <p>
          Lorem ipsum dolor, sit amet consectetur adipisicing elit. Molestiae,
          et.
        </p>
      </header>
    </section>
    <script src="../javascript/main.js"></script>
  </body>
</html>

Customizing the redirect domain for Google sign-in

okay i want to change the default domain here but i dont want to show any domain i want to show only app name is it possible?
when user click on on the continue with google an account chooser page comes up the i can see a option
Choose an account
to continue to clt-360314.firebaseapp.com

i want it like
Choose an account
to continue to “My Name”

i have added the dns record to hosting and also added it as auhorized domain to firebase console now i dont knwo why i these two steps i really want help what i need to do to achieve this..

Making a node.js api- a different need

I don’t know how to make the code showable to the client after the client submit the form and don’t know also how to make the client submit more than one (multiply times) i want it like this:
—the form—
input
input
input
submit button

–here show the response–

and the client able to send multiply submits and the response show as above.
also it give me this error:

/home/runner/costalica/index.js:87
      })
        

SyntaxError: Unexpected end of input

Here is my code:

const fetch = require('node-fetch');
const express = require('express');
const app = express();

// Parse request bodies
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.listen(3000);
app.get('/', (request, response) => {
  let responseHTML = `
    <html>
      <body>
        <h1>Login Form</h1>
        <form method="POST" action="/">
          <label for="csrf_token">CSRF Token:</label> 
          <input type="text" name="csrf_token" id="csrf_token"><br>   
          
          <label for="email">Email:</label>  
          <input type="email" name="email" id="email"><br>
          
          <label for="password">Password:</label>  
          <input type="password" name="password" id="password"><br>
          
          <input type="submit" value="Submit">
        </form>
      </body>
    </html>
  `
  response.send(responseHTML)
})

app.post('/', (req, res) => {
  const { csrf_token, email, password } = req.body;

  const data = `{
    "_csrf_token": "${csrf_token}", 
    "email": "${email}", 
    "grant_type": "PWD", 
    "page": "AccountLogin", 
    "password": "${password}",
    "recaptchaResponse": null, 
    "recaptchaSiteKey": null, 
    "step": "password",
    "userDefaultedToPassword": false 
  }`;

  let reqq = fetch('https://scrapeninja.p.rapidapi.com/scrape', {
    method: 'POST',
    headers:
    {
      "Content-Type": "application/json",
      "x-rapidapi-host": "HIDDEN",
      "x-rapidapi-key": "HIDDEN"
    },
    body: JSON.stringify({
      "url": "https://www.wayfair.com/a/account/authentication/login",
      "method": "POST",
      "headers": [
        "authority: www.wayfair.com",
        "accept: application/json",
        "accept-language: en-US,en;q=0.9,ar;q=0.8",
        "content-type: application/json",
        "cookie: WFDC=DSM; CSNUtId=412864fc-a9f8-405c-8e19-aa56c086d7ea; ExCSNUtId=412864fc-a9f8-405c-8e19-aa56c086d7ea; vid=23e17d3a-64a8-81d9-9e3c-5c0227712302; SFSID=ed904601ed2bb197bcbf8d4f7643e8cc; canary=0; serverUAInfo=%7B%22browser%22%3A%22Google%20Chrome%22%2C%22browserVersion%22%3A114%2C%22OS%22%3A%22Windows%22%2C%22OSVersion%22%3A%2210%22%2C%22isMobile%22%3Afalse%2C%22isTablet%22%3Afalse%2C%22isTouch%22%3Afalse%7D; __px_jnfwwtr_5=disable; _pxhd=bytlkNG5QrgGWPC-1RImOXynN/cLl26bEP24UXFCHXT4He3u0Wh/mg3ui2mytf2n27lyNOZ85vc-lS7T36UIWw==:eLUfj4aK5RXvvmjDlAlCh8zSBU-3GpStZIT2o40y1HojI1D3p7xCH/aXJfZGO9TizTXeUiEBw5yVXmJFLaHL8fQYbI6z3V8rtEWJuu6zneo=; CSN_CSRF=c60cafb9043d3d61febb81a38d23ece011ecf59df63774332d8a1be0c401fe52; __cf_bm=OYuVFxcPmLDoUgBGpP7Nj78NQm5R.Jr7cK8ggEIR3Wo-1688764889-0-AejgIZQcufTBjfmr47Oi/soHVUy7JtWjQ0r9cSXFy8T+Rznig68CKCwIFVNcjBEv3llV7a66LjzOq8HiB9IQIac=; CSN=g_countryCode%3DUS%26g_zip%3D67346; CSNPersist=page_of_visit%3D5; _wf_fs_sample_user=true; ibb=1; CSNID=FCD55A66-8513-46C7-A656-C2C65BB20149; WFCS=CS9; g_state={"i_p":1688772129177,"i_l":1}; hideGoogleYolo=true",
        "origin: https://www.wayfair.com",
        "referer: https://www.wayfair.com/v/account/authentication/login?url=https%3A%2F%2Fwww.wayfair.com%2F&context=header_wayfair_my_account_menu",
        "sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"",
        "sec-ch-ua-mobile: ?0",
        "sec-ch-ua-platform: "Windows"",
        "sec-fetch-dest: empty",
        "sec-fetch-mode: cors",
        "sec-fetch-site: same-origin",
        "sec-gpc: 1",
        "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67",
        "x-auth-caller-context: auth_main_page_context",
        "x-csn-csrf-token: c60cafb9043d3d61febb81a38d23ece011ecf59df63774332d8a1be0c401fe52",
        "x-parent-txid: I+F9OmSoge50vzFQLI6HAg==",
        "x-requested-with: XMLHttpRequest"
      ],
      "data": data
    })
});
    reqq.then(res => {
        const json = res.json();
        responseHTML += `<pre>${JSON.stringify(json, null, 2)}</pre>`
      })`

Why value returned by async function create a promise that resolve before synchronous code?

Take a look at this code:

async function fun() {
    return 5;
}

console.log(fun());

Here I have tried to return a promise that resolves with value 5, and tried to log the returned object. I was expecting the output to be Promise{<pending>} but it logged Promise{5}.

Then I tried this:

async function fun() {
    return Promise.resolve(5);
}

console.log(fun());

Now, this gives the output Promise{<pending>}. Why is this happening? The fulfillment of a Promise should happen after the completion of synchronous code. Then why I am getting the resolved promise as output in the first case?

The react-beautiful-dnd doesn’t work in initial render in a Kanban board

I’ve successfully added a Kanban board to my Next.js and TypeScript project.
However, I encountered a minor issue during the initial render and when I refreshed the page drag and drop feature doesn’t work but when I removed the <div key={board.id}> part of the code and saved the file, or reverted it back and saved the file, the drag and drop functionality started working perfectly.

I suspect that the issue is related to the initial rendering.

Thank you in advance for any assistance!

Console errors:
enter image description here

Here is the complete code:

import { useEffect, useState } from 'react'
import {
  DragDropContext,
  Draggable,
  DropResult,
  Droppable
} from 'react-beautiful-dnd'
import { BsArrowRight, BsPlus, BsThreeDotsVertical } from 'react-icons/bs'
import RadialProgrss from '../RadialProgress'

interface Candidate {
  id: number | string
  priority: number
  title: string
  description?: string
}

interface Board {
  id: number | string
  name: string
  items: Candidate[]
}

function createGuidId(): string {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    const r = (Math.random() * 16) | 0
    const v = c === 'x' ? r : (r & 0x3) | 0x8
    return v.toString(16)
  })
}

const initialData: Board[] = [
  {
    id: '1000',
    name: 'Candidates',
    items: [
      {
        id: '1',
        priority: 0,
        title: 'Amin Azimi',
        description:
          'Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia,'
      },
      {
        id: '2',
        priority: 1,
        title: 'Max Vokshoor',
        description:
          'Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia,'
      }
    ]
  },
  {
    id: '1001',
    name: 'Invite to interview',
    items: [
      {
        id: '3',
        priority: 2,
        title: 'John Walsh',
        description:
          'Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia,'
      }
    ]
  }
]

export default function Kanban() {
  const [boardData, setBoardData] = useState<Board[]>(initialData)
  const [showForm, setShowForm] = useState(false)
  const [ready, setReady] = useState(false)
  const [selectedBoard, setSelectedBoard] = useState(0)

  useEffect(() => {
    if (typeof window !== undefined) {
      setReady(true)
      setBoardData(initialData)
    }
  }, [])

  const onDragEnd = (result: DropResult) => {
    if (!result.destination) return

    const sourceBoardIndex = parseInt(result.source.droppableId)
    const destinationBoardIndex = parseInt(result.destination.droppableId)

    const sourceItems = [...boardData[sourceBoardIndex].items]
    const [draggedItem] = sourceItems.splice(result.source.index, 1)

    const destinationItems = [...boardData[destinationBoardIndex].items]
    destinationItems.splice(result.destination.index, 0, draggedItem)

    const newBoardData = [...boardData]
    newBoardData[sourceBoardIndex] = {
      ...newBoardData[sourceBoardIndex],
      items: sourceItems
    }
    newBoardData[destinationBoardIndex] = {
      ...newBoardData[destinationBoardIndex],
      items: destinationItems
    }

    setBoardData(newBoardData)
  }

  const onTextAreaKeyPress = (e: any) => {
    if (e.keyCode === 13) {
      //Enter
      const val = e.target.value
      if (val.length === 0) {
        setShowForm(false)
      } else {
        const boardId = e.target.attributes['data-id']!.value
        const item: Candidate = {
          id: createGuidId(),
          title: val,
          priority: 0,
          description:
            'Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia,'
        }
        let newBoardData = [...boardData]
        newBoardData[boardId].items.push(item)
        setBoardData(newBoardData)
        setShowForm(false)
        e.target.value = ''
      }
    }
  }

  return (
    <>
      {ready && (
        <div className="h-screen w-full">
          <DragDropContext onDragEnd={onDragEnd}>
            <div className="grid grid-cols-4 gap-5">
              {boardData?.map((board, bIndex) => {
                return (
                  <div key={board.id}>
                    <Droppable droppableId={bIndex.toString()}>
                      {(provided, snapshot) => (
                        <div
                          {...provided.droppableProps}
                          ref={provided.innerRef}
                        >
                          <div
                            className={`relative flex flex-col overflow-hidden rounded-md bg-gray-100 ${
                              snapshot.isDraggingOver ? 'bg-gray-200' : ''
                            }`}
                          >
                            <div className="mb-3 p-3">
                              <h4 className="flex items-center justify-between rounded-[8px] bg-white p-3">
                                <span className="text-[18px] text-gray-600">
                                  {board.name}
                                </span>
                                <BsThreeDotsVertical className="h-5 w-5 text-gray-500" />
                              </h4>
                            </div>

                            <div
                              className="h-auto overflow-y-auto overflow-x-hidden"
                              style={{ maxHeight: 'calc(100vh - 290px)' }}
                            >
                              {board?.items?.length > 0 &&
                                board?.items?.map(
                                  (item: Candidate, iIndex: number) => {
                                    return (
                                      <Draggable
                                        index={iIndex}
                                        draggableId={item.id.toString()}
                                        key={item.id}
                                      >
                                        {iProvided => (
                                          <div
                                            ref={iProvided.innerRef}
                                            {...iProvided.draggableProps}
                                            {...iProvided.dragHandleProps}
                                            className="m-3 mt-0 rounded-md bg-white p-3 last:mb-0"
                                          >
                                            <h4
                                              className="mb-6 flex items-center justify-between 
                                        rounded-[8px] bg-white "
                                            >
                                              <span className="text-[18px] text-gray-600">
                                                {item.title}
                                              </span>
                                              <BsThreeDotsVertical className="h-5 w-5 text-gray-500" />
                                            </h4>
                                            <p className="mb-6 text-[14px] text-gray-600">
                                              {item?.description}
                                            </p>

                                            <div className="flex justify-between">
                                              <div className="flex items-center gap-2">
                                                <RadialProgrss percent={75} />
                                                <p className="text-[14px]">
                                                  2 Comments
                                                </p>
                                              </div>

                                              <p className="text-[14px flex items-center gap-2 text-secondary-second-70">
                                                Read more <BsArrowRight />
                                              </p>
                                            </div>
                                          </div>
                                        )}
                                      </Draggable>
                                    )
                                  }
                                )}
                              {provided.placeholder}
                            </div>

                            {showForm && selectedBoard === bIndex ? (
                              <div className="p-3">
                                <textarea
                                  className="w-full rounded border-gray-300 p-3 focus:ring-purple-400"
                                  rows={3}
                                  placeholder="Some info"
                                  data-id={bIndex}
                                  onKeyDown={e => onTextAreaKeyPress(e)}
                                />
                              </div>
                            ) : (
                              <button
                                className="my-3 flex items-center justify-center space-x-2 text-lg"
                                onClick={() => {
                                  setSelectedBoard(bIndex)
                                  setShowForm(true)
                                }}
                              >
                                <span>Add New</span>
                                <BsPlus className="h-5 w-5 text-gray-500" />
                              </button>
                            )}
                          </div>
                        </div>
                      )}
                    </Droppable>
                  </div>
                )
              })}
            </div>
          </DragDropContext>
        </div>
      )}
    </>
  )
}


The datepicker is hidden when table data is less inside tabs

There is a datepicker inside tabe. When I open datapicker it will work correctly when the table data is more but if I remove table data it hiding inside..adding both screen .(Angular project)

Datepicker when table data is more
Datepicker when table is less or not available

I tried to add drop up using java script but it when I open drop it also hiding inside as I added screenshot. Also tried “datepicker-append-to-body”.

How can I install JSON-SERVER in Windows 7

Download and Install JSON-SERVER for Windows 7 64bit or 32bit and Low-end PC

First of all. We’ll install NodeJS version 16.16.0 in Windows 7 <Watch this video to do “https://www.youtube.com/watch?v=gSrnYSvOICY&t=1s”>

.then we open VS code and type command to terminal is npm init.(To check npm version to see it’s npm 9.8.0 version, if it’s different then use the command to update with code npm i -g [email protected] and type npm init in the terminal again)

And now, let’s type npm i json-server to install json-server

Create a db.json file with some data example:
{ "courses": [ { "id": 1, "name": "JavaScript", "description": "Nothing is imposible" } ] }

Next, open package.json file and add this code "start": "json-server --watch db.json", inside "scripts": {} example:
"scripts": { "start": "json-server --watch db.json", "test": "echo "Error: no test specified" && exit 1" },
Save that file

Finally, start JSON Server with the command is npm start

get API http://localhost:3000/courses

Web-audio-Recorder library does not work on vue 3 but perfectly works on vue 2

Error screenshot 1 here

Error screenshot 2 here

WebAudioRecorder JS is an old audio recorder library and its recorded mp3 is crossplatform supported. I couldn’t find better option to use in my app.

WAR (WebAudioRecorder) works perfectly on vue 2 as we needed. But it shows error while used in vue 3.

WebAudioRecorder.min.js:1 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Worker': #<Object> could not be cloned. at Proxy.setOptions

Any idea how can i fix it. Or Do you know any other voice recorder library that works on all browsers?

Means recorded audio in one browser works on all other browsers. Mostly it fails on Safari and apple devices.

Thanks in advance. Here are 2 code sandbox for you.

I have tried vue-audio-recorder it is crossplatform supported but it shifts voice tone and provides unstable transcription while using Deepgram(provides Speech to text service).

Completing a difficult sorting problem using JavaScript

I’m currently completing a task on time sequencing, and I’m having a hard time finding help!

//Example 1:
let input = [
    { time: '01:00~02:00' },
    { time: '02:00~03:36' },
    { time: '00:00~03:36' },
    { time: '01:00~02:30' },
];

let output = [
    { time: '00:00~03:36' },
    { time: '01:00~02:00' },
    { time: '02:00~03:36' },
    { time: '01:00~02:30' },
];
//Example 2:
let input = [
    { time: '00:00~03:36' },
    { time: '00:00~02:00' },
    { time: '01:00~02:30' },
    { time: '02:00~03:36' },
];

let output = [
    { time: '00:00~02:00' },
    { time: '02:00~03:36' },
    { time: '00:00~03:36' },
    { time: '01:00~02:30' },
];
//I have used the sort method for sorting, but the output is this:
[
    { time: '00:00~03:36' },
    { time: '01:00~02:00' },
    { time: '01:00~02:30' },
    { time: '02:00~03:36' },
];

I’ve thought of many ways to deal with the time ordering problem, but I can’t find a pattern…

I’ve been reading how CORS work and tried everything that made sense, still my React/Vite App is failing to reach my express API due to CORS error

I am doing a little exercise for setting up an authentication service, the API finally seems to work, but when I try to reach it through the browser I can’t get it to work. My app is running on Vite with React and the backend is made with Express. I am doing my request using Axios through an Axios Instance.
This is the codebase https://github.com/dariogliendo/mern-comuna
If you don’t want to check out the whole repository (it’s a pretty simple one), this is my main server code:

import express from 'express'
import auth from './API/auth.js'
import cors from 'cors'
import bodyParser from 'body-parser'
import mongoose from 'mongoose'

const app = express()
app.use(cors())
app.use(bodyParser.json())
app.use(auth)
const port = 8000


mongoose.connect('mongodb://127.0.0.1:27017')
  .then(() => {
    console.log('Connection to MongoDB established')
  })
  .catch(err => {
    console.error('Failed to connect to Mongo', err)
  })
app.listen(port, () => {
  console.log(`Express server listening on ${port}`)
})

This is my Axios Instance code

import axios from "axios";

const instance = axios.create({
  baseURL: import.meta.env.VITE_REACT_APP_BASE_URL,
  withCredentials: false,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8',
  }
})

export default instance

Here baseURL is http://localhost:8000, the URL to my express erver

and finally this is my request call in the login component

const token = await axiosInstance.post('/auth/login', {
        email: email,
        password: password,
      })
      console.log(token)

I’ve read a lot of questions and responses, tried a whole bunch of stuff, but can’t get it to work. I suspect I might be lacking some understanding of how Vite works in this regards. I do not want to use a URL proxi like cors-anywhere, I would like my code to be abled to be used for production.

I’ve tried a lot of things, a little recap:

  • Using the cors NPM package
  • Setting up my headers manually
  • Using route-specific headers
  • Specifying Content-Type client-side
  • Setting up a proxy for the Vite dev-server (probably badly)

I expect to reach the authentication code with no CORS error

Set a different value depending on users Screen Size [duplicate]

I have a web page which is accessible on mobile phone or pc desktop.

When users are viewing the page on mobile the input fields are different sizes to what is seen on a pc desktop. So I thought I would size the input fields depending on what screen size the user is using.

I tried setting a % using the width tag, but found that didn’t work for both mobile and pc desktop views.

I have also tried this code, but can’t work out why it doesn’t work.


    <?php

    $window_width = "<script type='text/javascript'>document.write(window.innerWidth);</script>";
    
    if ($window_width > '800'){
    $widthpx = '265';
    } else {
    $widthpx = '50';
    }

    ?>

    <input type='text' name='amount' style='width:<?php echo $widthpx;?>px;'>

    Window width = <?php echo $window_width;?>

When I goto the page on the pc desktop, it shows in the variable $window_width = 1908 and on the mobile $window_width = 465 yet the setting of the variable $widthpx is 265 for both.

On pc desktop you can see the webpage show the variable result as “1908” for $window_width

On the mobile you see the webpage is showing “465” for $window_width

I have tried for ages and can’t see what is wrong.

Combine orderByChild and filters in Firebase?

Is it possible to combine orderByChild by a filter such as ordering alphabetically by letter:

import { getDatabase, ref, query, orderByChild, startAt} from "firebase/database";

const db = getDatabase();
const recentPostsRef = query(ref(db, 'users'), orderByChild('username')), startAt('A'));

And even if, how to reach that goal in Pinia, if the data is already fetched by an action completely and stands?

Not able to render a complete component in my react app

I am learning react and currently a newbie.
While creating a react app which has multiple components I stumbled upon an issue which i am not able to resolve as of now.

Here is my code:

import React from 'react';
import "./style1.css";

function left() {
  return (
    
    <div className='container_left'>
        <h2 className='head'>Pocket Notes</h2>
        <button id='newGroup'> 
          <span className='plus'> + </span>
          Create Notes Group
        </button>
    </div>
    
  )
}

export default left;
/* Styles for container_left */

body{
    font-family: roboto;
    padding: 0;
    margin: 0;
}

.container_left {
    background-color: #ffffff;
    width: 25vw;
    height: 100vh;
}

.head {
    margin: 0;
    padding: 40px 20px 20px 10px;
    font-size: 25px;
    margin-left: 1.5rem;
}

.plus {
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    font-size: 30px;
    font-weight: 500;
    margin-right: 5px;
}

#newGroup {
    line-height: 1;
    color: #ffffff;
    background-color: #000000;
    border: 2px solid #000000;
    padding: 3px 18px 3px 18px;
    font-size: 18px;
    margin-top: 20px;
    margin-left: 5rem;
    border-radius: 25px;
    letter-spacing: .1rem;
    cursor: pointer;
}

This is my left component which will be on the left side which renders perfectly.

import React from 'react';
import "./style2.css";

function Right() {
  return (

    <div className='container_right'>
      <p className='para'>Send and receive messages without keeping your phone online.
      Use Pocket Notes on up to 4 linked devices and 1 mobile phone</p>
    </div>

  )
}

export default Right;
/* Styles for container_right */

body{
    font-family: roboto;
    padding: 0;
    margin: 0;
    /* background-color: #F7ECDC; */
}

.container_right {
    background-color: #F7ECDC;
    width: 75vw;
    height: 100vh;
}

.para {
    color: #000000;
    text-align: center;
    position: relative;
}

This is my right element which makes the issue.
Its not rendering as i want. It should display the color on 75% viewport and also display the contents inside it which its not doing.
Also when i tried looking into the developer tools the right elements box model is visible in the tools section but when its selected the page doesn’t highlight the right section while it does for the left section.

I tried providing background color to the body which works fine but still the issue is that the content in the right container is not visible in any of the cases.

I also tried giving the right section a pseudo element –> solves the problem for the background color but same issue persists that the content inside the container is not visible.

.container_right::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F7ECDC;
    opacity: 0.8;
    z-index: -1;
  }

Kindly help!

Hiding Element With sessionStorage AND Adding A Class to A Different Element

I have an announcement bar on the top of my website (part of a fixed position header) and am using sessionStorage to permanently hide it across all pages once the user has either clicked the close button. Because it’s a fixed header, hiding this announcement element unfortunately leaves 30px between the header and the rest of the page. I’m trying to add a class to another div tag to decrease either the height or padding by 30px but can’t figure out the proper syntax to get me there.

So far, I have:

 $(".close-this").click(function() {
    $("#announcement").addClass("hidden");
  });
(function( d ) {
   'use strict';
   var element = d.getElementById( 'announcement' );
       element.classList.add( sessionStorage.getItem( 'remove-link' ) );
       element.addEventListener( 'click',
         function(){
                     sessionStorage.setItem( 'remove-link', 'hidden' );

                   }, false);
}( document ));
<div id="announcement">
   <a href=".../contact/">BOOK US NOW</a>
   <span id="close-it" class="close-this" type="button" ></span>
</div>

I’ve tried just about everything and can’t seem to get a class added to another div when announcement is clicked.