Hide slider thumb in material-ui library

I’m trying to hide the slide thumb. I tried to do it without using a library but then I think that it should be better to use material-ui because maybe it would be easier but I’m here asking help.

Here is my code:

import * as React from "react";
import Slider from "@mui/material/Slider";
import "./style.css";

export default function ContinuousSlider() {
  const [value, setValue] = React.useState(30);

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };

  return (
    <Slider
      aria-label="Volume"
      value={value}
      onChange={handleChange}
      focusVisible={false}
    />
  );
}

style:

.MuiSlider-thumb {
  background-color: orange;
  box-shadow: none;
  width: 0px;
  height: 0px;
}

.MuiSlider-rail {
  background-color: orange;
  border: none;
}

.MuiSlider-track {
  background-color: red;
  border: none;
}

.MuiSlider-rail {
  background-color: green;
}

working code here

result:

enter image description here

on focus

enter image description here

I was able to hide the main thumb but not the “secondary thumb”. I don’t know how to call it, the light blue one that appears clicking on the thumb.
How can I remove it?

I want the following style always, even when user drag the thumb:
enter image description here

QuerySelector only functioning for one ID, multiple values will not work

recently, I have been trying to create a wordle game but with 8 letters, and it has been going well, though, when I input my answer into the div boxes, only the first div gets a response when I click the big “CHECK” button. I tried using querySelectorAll but that did not work, I also tried making it respond to all div elements but that broke some functionality, and did not give me what I wanted. Basically, what I want is to have functionality for all the divs when the “check” button is pressed.

Here is some of my code:

JS:

    const pText = document.querySelector("#p123").innerText.toUpperCase()
const div = document.querySelector("#amo1, #amo2, #amo3, #amo4, #amo5, #amo6, #amo7") // I tried one value and that worked, multiple values will not work for me, this is the main problem.
const button = document.querySelector("#button123")


button.addEventListener("click", () => {
  const text = div.textContent.toUpperCase()

  //don't check if there are numbers/non letters and text length < 8
  if (text.match(/d/gi) || text.length < 1 || text.match(/[^a-z]/gi)) {
    div.innerText = text
    return
  }

  div.innerHTML = ""
  text.split("").forEach((letter, i) => {
    if (pText.includes(letter) && pText[i] === letter) {
      div.innerHTML += `<span style="color: lime">${letter}</span>`
    } else if (pText.includes(letter)){
      div.innerHTML += `<span style="color: orange">${letter}</span>`
    } else {
      div.innerHTML += `<span style="color: lightgrey">${letter}</span>`
    }
  })
})

//blur the div if text is longer than 8 letters or key = "space"
div.addEventListener("keydown", (e) => {
  if (div.innerText.length > 0 || e.keyCode == 32) {
    div.blur()
  }
})

//clear on focus
div.addEventListener("focus", () => {
  div.innerHTML = ""
})

HTML:

<p id = "p123">ABsOLUTE</p>
<div id = "div123" contenteditable="true" style="border: 5px solid; padding: 5px; font-size: 22px; font-weight: bold; text-transform: uppercase;" spellcheck="false"></div>
<button id = "button123">check</button>

<div class="square">
 <img/>
</div>
   <div id="game-board">

   </div>
<details>
 <summary class = "summary1">Octordle Summary</summary>
 <h2 class = "summary-content">Octordle is similar to the hit game Wordle, but 8 letters instead of 5.</h2>
</details>

<!-- <input type = text class = "text-box">
<input type = text class = "text-box2"> -->
<div id = "amoo">
<div class="container" style = "position:relative; left:825px; top:-400px;" id = "testu">



    <div oninput = "inputFunc()" tabindex = "1" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo1"></div>
    <div oninput = "inputFunc()" tabindex = "2" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo2"></div>
    <div oninput = "inputFunc()" tabindex = "3" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo3"></div>
    <div oninput = "inputFunc()" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo4"></div>
    <div oninput = "inputFunc()" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo5"></div>
    <div oninput = "inputFunc()" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo6"></div>
    <div oninput = "inputFunc()" class = "amot" onkeypress="return (this.innerText.length <= 0)" contenteditable = "true" id = "amo7"></div>

Here is all my lines of code in a sololearn project: https://code.sololearn.com/WX59M6HHngc5
Please help, thank you in advance. (By the way, ignore the text input above the “check” box, that was just for testing, I’m focusing on the grid boxes right now)

Draggable SVG element that can be adjusted with arching handles

I’m created a stickman with draggable arms and legs by using the PlainDraggable library. It has all movable limbs, but the movement is a bit rough.

There is a function that shows handles for arching, it’s shown on the PlainDraggable example, but it’s not mentioned in the documentation so I don’t how to replicate it.

It looks like this and their working example is here:

enter image description here

Does anyone know how can I add these handles on my stickman so I can make limbs appear smoother?

Here is the JSFiddle with what I got so far.

JavaScript

import PlainDraggable from "https://cdn.skypack.dev/[email protected]";
import leaderLineNew from "https://cdn.skypack.dev/[email protected]";
var pt1 = document.getElementById('300-50');
var pt2 = document.getElementById('50-50');

var leftArm = document.getElementById('left-arm');
var leftHand = document.getElementById('left-hand');
var rightArm = document.getElementById('right-arm');
var rightHand = document.getElementById('right-hand');

var leftLeg = document.getElementById('left-leg');
var leftFoot = document.getElementById('left-foot');
var rightLeg = document.getElementById('right-leg');
var rightFoot = document.getElementById('right-foot');

var characterLeftArm = new leaderLineNew(leftArm, leftHand, {
  endPlug: 'behind'
});

var characterRightArm = new leaderLineNew(rightArm, rightHand, {
  endPlug: 'behind'
});

var characterLeftLeg = new leaderLineNew(leftLeg, leftFoot, {
  endPlug: 'behind'
});

var characterRightLeg = new leaderLineNew(rightLeg, rightFoot, {
  endPlug: 'behind'
});


function fixline(){
  characterLeftArm.position();
  characterRightArm.position();
  characterLeftLeg.position();
  characterRightLeg.position();
}

var elements = document.querySelectorAll(".movable")
for(let i = 0; i < elements.length; i++){
  var draggable = new PlainDraggable(elements[i], {onMove: fixline});
}

HTML:

<div>
  <svg id="rig" viewBox="-105 197 400 400">
    <g class="movable">
      <path  d="M96.4,338.1v-5.6c20.1-1.1,36.1-17.8,36.1-38.2c0-21.1-17.1-38.3-38.3-38.3c-21.1,0-38.3,17.1-38.3,38.3
                c0,20.4,16,37.1,36.1,38.2v5.6c-22.6,1.7-40.5,29.6-40.5,63.9c0,35.3,19.1,64,42.7,64s42.7-28.7,42.7-64
                C137,367.7,119,339.7,96.4,338.1z"/>
      <circle id="left-arm" cx="76.1" cy="345.6" r="1.3"/>
      <circle id="right-arm" cx="112.3" cy="345.6" r="1.3"/>
      <circle id="left-leg" cx="83.6" cy="462.6" r="1.3"/>
      <circle id="right-leg" cx="105" cy="462.6" r="1.3"/>
    </g>
    <g class="movable">
      <circle id="right-foot" cx="146.1" cy="518.5" r="1.3"/>
      <ellipse class="st0" cx="158.3" cy="526.9" rx="20.2" ry="12.3"/>
    </g>
    <g class="movable">
      <circle id="left-foot" cx="44.4" cy="518.5" r="1.3"/>
      <ellipse class="st0" cx="32.2" cy="526.9" rx="20.2" ry="12.3"/>
    </g>
    <g class="movable">
      <circle id="right-hand" cx="166.2" cy="404.5" r="1.3"/>
      <circle class="st0" cx="166.2" cy="415.6" r="12.3"/>
    </g>
    <g class="movable">
      <circle id="left-hand" cx="24.2" cy="404.6" r="1.3"/>
      <circle class="st0" cx="24.2" cy="415.6" r="12.3"/>
    </g>
  </svg>
</div>

How do I compare multiple value pares in an array?

I have an array that looks like:

export const data = [
  { id: 1, option1: "Hot", option2: "Cold",answer: "Hot" },
  { id: 2, option1: "Option 1", option2: "Option 2", answer: "Option 1" },
  { id: 3, option1: "Active", option2: "Not Active", answer: "Active" },
];

I’m trying to create a component / write a function that compares the option selected with the answer to display whether a user has checked the right answers. What I have to riht now checks to see if each answer is correct and displays text for each answer rather that a total comparison. How do I change this?

function App() {
  return (
    <>
      <div className={styles.wrapper}>
        {data.map((data, idx) => (
          <Fragment key={idx}>
            <ComponentForRenderingOption leftText={data.option1} rightText={data.option2} />
            <div className={styles.answer}>
              The answer is:
              {data.option1 === data.answer ? "Correct" : "Incorrect"}
            </div>
            ;
          </Fragment>
        ))}
      </div>
    </>
  );
}

export default App;

What ends up being rendered looks like:
enter image description here

Refactoring condition for Math absolute

Currently trying to refactor my code down to make it more simple and DRY, is there a way to combine Math.absolute together so that the <= 1 and Math.abs() does not keep repeating?

Math.abs(rowIndex - nodeRowIndex) <= 1 && Math.abs(colIndex - nodeColIndex) <= 1

Edited: adding this in in case it makes more sense. Currently trying to refactor my code block down and see that the <= 1 and Math.abs are repeating

/*
* This function finds the neighbor of a given node's coordinate in a 2D array graph
* and returns the valid neighbor found within it 
*
* @param {array} node; e.g. [2, 0]
* @param {array} matrix; e.g. [[1, 2, 4], [4, 5, 9], [5, 7, 6]] 
* @return {array} valid array of node's neighbors
*/
function findNeighbors(node, matrix) {
    
    // create array to store neighbors
    const neighbors = [];

    // destructure node row and node column index for easier usage
    const [nodeRowIndex, nodeColIndex] = node;

    // get the node value to be use for comparison with each matrix's value and cell information
    const nodeVal = matrix[nodeRowIndex][nodeColIndex];

    // in each row, get the row value and row index...
    matrix.map((currRow, rowIndex) =>
        // in each column, get the column value and column index...
        currRow.map((currCellVal, colIndex) => 
            // if the row index and column index is less than or equal to 1 difference
            // between the node's row/col index
            Math.abs(rowIndex - nodeRowIndex) <= 1 && Math.abs(colIndex - nodeColIndex) <= 1
                // AND if the current cell value is only 1 difference than the node's value then...
                && Math.abs(currCellVal - nodeVal) <= 1 && 
                    // ALSO check if the current row and column index is not the same as the node's
                    // row and column index
                    !(rowIndex === nodeRowIndex && colIndex === nodeColIndex) ? 
                    
                    // if passed all checks, push the current row and column into neighbors
                    // otherwise, do nothing
                    neighbors.push([rowIndex, colIndex]) : ""
        ) // end currRow map
    ); // end matrix map

    // return the neighbors thereafter
    return neighbors;
} // end findNeighbor function

How can I replace and removing space in the keys in object javascript?

I have object like this :

let output = 
[
  {
    Email: '[email protected]',
    KolomB: 'Haha',
    KolomC: 6,
    ' Kolom D ': '3.000.000',
    KolomE: 2022-01-01T16:59:48.000Z
  },
  {
    Email: '[email protected]',
    KolomB: 'blabla',
    KolomC: 6,
    ' Kolom D ': '3.000.000',
    KolomE: 2022-01-01T16:59:48.000Z
  }
]

I want to remove the spaces if occurs in keys inside the object.

this is my desired output :

output = 
[
  {
    Email: '[email protected]',
    KolomB: 'Haha',
    KolomC: 6,
    KolomD: '3.000.000',
    KolomE: 2022-01-01T16:59:48.000Z
  },
  {
    Email: '[email protected]',
    KolomB: 'blabla',
    KolomC: 6,
    KolomD: '3.000.000',
    KolomE: 2022-01-01T16:59:48.000Z
  }
]

As you can see, i want to remove the space in Kolom D to be KolomD in output variable.

Here’s what i’ve done before :

for (let i = 0; i < output.length; i++) {
 Object.keys(output[i]).forEach(function(key) {
  key = key.replace(/s+/g, "").replace(/^s+|s+$/g, "")
 })
}

but the output still not changing. How to push/changing the keys to the output ?

Please let me know if you need more information if it’s still not enough to solve that problem

How to combine animation and mask effect using a specific SVG image

I have an image with an overlay background color which has some opacity, and I want to create a “hole” effect on this image.

I want the “hole” to be a specific SVG image that I have, and I want this image to rotate.

I have created 2 examples in Codepen to help you understand what I want:

  1. Hole effect without animation: https://codepen.io/Giordanidis/pen/qBpQGVd
<body>
    <header></header>
    <main>
        <section class="banner-sec">
            <div class="banner height-100 width-100">
                <div class="banner-item height-100 width-100">
                    <div class="banner-img-wrapper height-100 width-100">
                        <img src="https://images.unsplash.com/photo-1638913662252-70efce1e60a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80" alt="" class="banner-img height-100 width-100">
                    </div>
                    <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M6 18.7241C6 12.6409 10.0359 7 15.5625 7C19.3976 7 22.2434 9.53088 24 13.1211C25.7565 9.53111 28.6022 7 32.4375 7C37.9647 7 42 12.6419 42 18.7241C42 31.7444 24 41 24 41C24 41 6 32.3045 6 18.7241Z" fill="#333333" />
                    </svg>
                </div>
            </div>
        </section>
    </main>
    <footer></footer>
</body>
* {
  margin: 0;
  padding: 0;
}

.height-100 {
  height: 100%;
}

.width-100 {
  width: 100%;
}

.banner-sec {
  display: block;
  height: 100vh;
  width: 100vw;
}

.banner-item {
  position: relative;
}

.banner-img {
  object-fit: cover;
}

.banner-item-bg {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: #000000;
  opacity: 0.75;
  z-index: 1;
}

.banner-item svg {
  fill: transparent;
  stroke: #f00;
  stroke-width: 1px;
  position: relative;
  width: 280px;
  z-index: 10;
  transition: all 0.3s ease;
  transform-origin: left center;
  animation: AnimateBannerGraphic 1s infinite;
}

.banner-item-mask {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  z-index: 1;
  mask-repeat: no-repeat;
  mask-size: 280px;
  mask-position: 85% center;
}

@keyframes AnimateBannerGraphic {
  0% {
    transform: rotate(0);
  }

  100% {
    transform: rotate(360deg);
  }
}
  1. Hole effect with animation (but without the “hole”): https://codepen.io/Giordanidis/pen/OJzaYZz
<body>
    <header></header>
    <main>
        <section class="banner-sec">
            <div class="banner height-100 width-100">
                <div class="banner-item height-100 width-100">
                    <div class="banner-img-wrapper height-100 width-100">
                        <img src="https://images.unsplash.com/photo-1638913662252-70efce1e60a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80" alt="" class="banner-img height-100 width-100">
                    </div>
                    <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M6 18.7241C6 12.6409 10.0359 7 15.5625 7C19.3976 7 22.2434 9.53088 24 13.1211C25.7565 9.53111 28.6022 7 32.4375 7C37.9647 7 42 12.6419 42 18.7241C42 31.7444 24 41 24 41C24 41 6 32.3045 6 18.7241Z" fill="#333333" />
                    </svg>
                </div>
            </div>
        </section>
    </main>
    <footer></footer>
</body>
* {
  margin: 0;
  padding: 0;
}

.height-100 {
  height: 100%;
}

.width-100 {
  width: 100%;
}

.banner-sec {
  display: block;
  height: 100vh;
  width: 100vw;
}

.banner-item {
  position: relative;
}

.banner-img {
  object-fit: cover;
}

.banner-item-bg {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: #000000;
  opacity: 0.75;
  z-index: 1;
}

.banner-item svg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  fill: red;
  height: 280px;
  width: 280px;
  z-index: 10;
  animation: AnimateBannerGraphic 2s infinite;
}

.banner-item svg path {
  fill: inherit;
}

.banner-item-mask {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  mask-repeat: no-repeat;
  mask-size: 280px;
  mask-position: 85% center;
}

@keyframes AnimateBannerGraphic {
  0% {
    transform: translate(-50%, -50%) rotate(0);
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

In the 1st example, you can see the background image, the background (black) color which has a 75% opacity, and also the SVG image (the heart icon) which acts like a “hole” and you can actually see “behind” the black color. What is missing here is the animation part that you can see in the 2nd example.

In the 2nd example, you can also see the background image and the background color, and also the SVG image, without the “hole” effect, but with the animation (rotation) I want.

My problem is that I cannot combine these two. As already mentioned I just want to somehow add the rotating animation (which you can see in the 2nd example) to the 1st example.

Is there any way I can do it with CSS or JS?

Thanks in advance!

I appreciate your help! Thanks in advance!

please could solve br tag in html it doesn’t work

Could somebody explain to me, please, how I might solve this issue?

I tried to add a <br> after the <small> tag, to put the text-box after the label of <small> element, but it doesn’t work.

<fieldset>
  <div class="row">
    <div class="col-md-12">
      <div class="form-group">
        <small style="text-align: left;">Customize this Card as Your Name</small><br>
        <input type="text" class="form-control input-lg" id="MyName" name="MyName" placeholder="Your Own Signature" maxlength="40">
      </div>

      <div class="form-group">
        <small>Choose a Card</small><br>
        <select class="form-control input-lg" onchange="showImage(this.value)">
          <option value="1">Model 1</option>
          <option value="2">Model 2</option>
          <option value="3">Model 3</option>
        </select>
      </div>
      <div class="form-group">
        <button id="btnPreview" name="btnPreview" onclick="reviewImage()" class="btn-success btn-lg btn-custom">Preview <div class="icons"><i class="fa fa-eye" aria-hidden="true" style="float:right"></i></div></button>
        <button type="button" id="btnDownload" name="btnDownload" class="btn-primary btn-lg btn-custom" onclick="downloadImage()">Download<div class="icons"><i class="fa fa-download" aria-hidden="true" style="float:right"></i></div></button>
      </div>
    </div>
  </div>
  <div class="row">
    <img id="imgCard" src="cards/1.png" alt="Eid Card" class="img-responsive responsiv_imageEn" />
    <canvas id="canvas" width="100%"></canvas>
  </div>
  <div class="row">
  </div>
</fieldset>

pass API result with non-relative components in react with Redux

I have an API result in Searchbar.jsx by redux. But I want to use the API result in a different Component and it has not a connection with SearchBar.jsx . So How do I implement it on my app

App.js

import './App.css';
import React, {  useEffect } from 'react';
import { Navbar, SearchBar, Header, Main, Chart, Map } from './components';
import { Routes, Route, BrowserRouter } from 'react-router-dom';
import useLocalStorage from 'use-local-storage';


function App() {
  
  const defaultDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
  const [theme, setTheme] = useLocalStorage('theme', defaultDark ? 'dark' : 'light');
  //  a function that toggles between darkmode and lightmode in css

  const switchTheme = () => {
    const newTheme = theme === 'light' ? 'dark' : 'light';
    setTheme(newTheme);
  }
  useEffect(() => {
    document.documentElement.setAttribute("data-theme", theme);

  }, [theme]);


  return (
    <BrowserRouter>
      <div className={`App`} data-theme={theme} >
        <div className='right'>
        <Header />
        <SearchBar />
        <Navbar  switchTheme={switchTheme} theme={theme}/>
        </div>
        <div className='left'>
        <Routes>
          <Route path="/" element={<Main />} />
          <Route path="/map" element={<Map />} />
          <Route path="/chart" element={<Chart />} />
        </Routes>
        </div>
      </div>
    </BrowserRouter>
  );
}

export default App;
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

Searchbar.jsx which I have a API result

import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import React, { useRef, useState, createContext } from 'react'
import { useGetListQuery, useGetSingleCitiesQuery } from '../services/api'
export const CityContext = createContext()


const SearchBar = () => {
  const [searchState, setSearchState] = useState({ country: 'Turkey', symbol: 'tur' })
  const [query, setQuery] = useState('') // for storing the query of User
  const { data, isFetching } = useGetListQuery()
  const { data: single } = useGetSingleCitiesQuery({ country: searchState.country, symbol: searchState.symbol })


  console.log(single) // this is the API result that I want to use it in Main.jsx


  CityContext.Provider = ({ children }) => {
    return (
      <CityContext.Provider value={{
        single 
      }}>
        {children}
      </CityContext.Provider>
    )
  }

  


  const inputArea = useRef(null)

  if (isFetching) {
    return <div>Loading...</div>
  }

  const focus = () => {
    inputArea.current.focus()
  }

  const inputHandler = (e) => {
    const lowerCasedQuery = e.target.value.toLowerCase()
    setQuery(lowerCasedQuery)
  }

  const filteredData = data.filter((item) => {
    return item.Country.toLowerCase().includes(query)
  })

  return (
      <div className="search-bar">
        <input
          ref={inputArea}
          type="text"
          placeholder="Search for a country"
          onChange={inputHandler}
        />
        <button onClick={focus}>
          <FontAwesomeIcon icon={faMagnifyingGlass} />
        </button>
        <div className="search-list">
          {filteredData.map((item) => {
            return (
              <div key={item.Country}>
                <p
                  onClick={() => {
                    inputArea.current.value = item.Country
                    inputHandler({ target: { value: item.Country } })
                    setSearchState({ country: item.Country, symbol: item.ThreeLetterSymbol })
                  }}
                >{item.Country}</p>
              </div>
            )
          })}
        </div>

      </div>
  )
}


export default SearchBar
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

Main.jsx I want to use API result in this component

import React, { useContext } from 'react'
import { CityContext } from './SearchBar'

const Main = () => {

  const single = useContext(CityContext)

  console.log(single)    // ???????????????????????????
// getting error of undefined

  return (
    <div>
      <CityContext.Consumer>
        {
          ({ single }) => {
            return (
              <div>
                {single.rank}
              </div>
            )
          }
        }

      </CityContext.Consumer>
    </div>
  )
}



export default Main
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

How to set CachePolicy in cloudfront using CDK’s CloudfrontWebDistribution Construct?

I am trying to set CachePolicy, OriginRequestPolicy and ResponseHeaderPolicy using CloudfrontWebDistribution Construct.In the Construct Props for OriginConfigs I am not able to see any option to set any of the 3 mentioned above.
I am aware that, CDK is pushing for using new construct distribution and i can see this construct props supports all 3 policies which are mentioned above.
is there a way to set these using cloudfrontWebDistribution construct ?

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html#migrating-from-the-original-clo[…]he-newer-distribution-construct

how to change name of a header in runtime in Openapi 3

I have an api in which a key:value is sent as a header to the server. I wonder whether i can create a dynamic header that its name is filled during run time by the client? I run the JSON file by swagger-ui application.

My API looks like this:

curl -x GET $theUrl -h “customKey:customValue”

I want the client write the key (which is name of the header in the JSON file) same as value in the run time. Even JS solutions are welcome.

HTML or React component

Good day, dear react developers. Can you please tell me the best way to create Popups or Dropdown menus?

Use classic React pattern:

function Popup() {
   const [isPopupVisible, setPopupVisibility] = useState<boolean>(false);

   return (<div>
       <button onClick={() => setPopupVisibility(true)}>Show popup</button>
   isPopupVisible && (<PopupContent />)
   </div>)
}

Or there is some way using HTML tag <details> and <summary>. And if so, which one?

Javascript Fetch Api not returning data

I have made a Restful Api using flask in python that returns “Hello World”.

app = Flask(__name__)
api = Api(app)

class MyApi(Resource):

    def get(self):
        return "Hello World"

api.add_resource(ProjectxApi, "/get/info")

if __name__ == "__main__":
    app.run(debug=True, port=8000)

I’m trying to get the data from the api through the fetch method in javascript. The thing is that the data returned doesn’t include “Hello world”. I’m new to javascript (I code in python), So excuse me if this is a basic question 🙂

Javascript code

fetch('http://127.0.0.1:8000/get/info', {
mode: "no-cors"
}).then(response => {
  console.log(response);
});

This is what is displayed on the console:

Thank you for your help !