react打造AA制结账付费app 可拖动ui交互页面代码

代码语言:html

所属分类:布局界面

代码描述:react打造AA制结账付费app 可拖动ui交互页面代码,每个人的结账费用可拖动,babel+react实现。

代码标签: react AA制 结账 付费 app 拖动 ui 交互 页面 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
  
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap");

body {
  font-family: "Inter", sans-serif;
  background:#ded9cf;
}

.yellow-text {
  color: #fcd3bc;
}

.custom-border {
  border-radius: 19px;
}
.blue-shadow {
  box-shadow: 4px 4px 4px rgba(47, 43, 79, 0.68);
}

.screen-shadow {
  box-shadow: 11px 11px 10px rgba(72, 66, 109, 0.43);
}

.blue-shadow-inner {
  box-shadow: inset -4px 4px 4px #2d284ade;
}

:root {
  --thumb-size: 24px;
  --thumb-color: transparent;
}

input[type="range"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  outline: none;
  position: absolute;
  margin: auto;
  top: 0;
  height: var(--thumb-size);
  background-color: transparent;
  pointer-events: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  height: var(--thumb-size);
}
input[type="range"]::-moz-range-track {
  -moz-appearance: none;
  height: var(--thumb-size);
}
input[type="range"]::-ms-track {
  appearance: none;
  height: var(--thumb-size);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  background-color: var(--thumb-color);
  cursor: pointer;
  pointer-events: auto;
}
input[type="range"]::-moz-range-thumb {
  border: none;
  outline: none;
  -webkit-appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  cursor: pointer;

  background-color: var(--thumb-color);
  pointer-events: auto;
}
input[type="range"]::-ms-thumb {
  border: none;
  outline: none;
  appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  cursor: pointer;

  background-color: var(--thumb-color);
  pointer-events: auto;
}
input[type="range"]:active::-webkit-slider-thumb {
  background-color: none;
}
input[type="range"]:focus::-moz-range-thumb {
  border: none;
  outline: none;
}
input[type="range"]:active::-moz-range-thumb {
  border: none;
  outline: none;
}

.arrow {
  animation: arrow-load 2s infinite;
}

.arrow:nth-child(1) {
  animation-delay: -0.6s;
}
.arrow:nth-child(2) {
  animation-delay: -0.6s;
}
.arrow:nth-child(3) {
  animation-delay: -0.4s;
}
.arrow:nth-child(4) {
  animation-delay: -0.2s;
}

@keyframes arrow-load {
  0% {
    opacity: 0;
    transform: translate(-15px, 0px);
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(15px, 0px);
  }
}
</style>


  
  
</head>

<body translate="no">
  <div id="root" class="h-screen w-screen grid place-items-center text-zinc-300"></div>
  <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.7.18.13.js"></script>
  <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.18.2.0.js"></script>
  <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.18.2.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/tailwindcss.3.4.3.js"></script>
      <script type="text/babel">
const { useEffect, useRef, useState} = window.React;
  const { render } = window.ReactDOM;
const splitWith = ["1", "2", "3"];
const imageBase = `https://repo.bfw.wiki/bfwrepo/images/split/bill-splitter-app-`


function App() {
  return (
    <>
      <div className="h-[700px] flex space-x-12 items-center">
        <ScreenA />
        <ScreenB />
      </div>
    </>
  );
}


function Screen({ children, className }) {
  return (
    <>
      <div
        className={`bg-[#48426d] screen-shadow w-80 h-[640px]  p-7 rounded-3xl ${className}`}
      >
        {children}
      </div>
    </>
  );
}


function ScreenA() {
  return (
    <Screen className="-translate-y-5">
      <Header />
      <TotalBill />
      <PrvSplit />
      <NearbyFriends />
    </Screen>
  );
}


function Header() {
  return (
    <div className="flex justify-between mt-3">
      <div className="yellow-text text-lg">
        <div className=""> Orix </div>
        <div className="font-bold"> Bill Splitter </div>
      </div>
      <div className="w-16 h-16 relative">
        <div
          className="absolute inset-0 bg-[#342f52] overflow-hidden"
          style={{ border: "2px solid #544e75", borderRadius: "15px" }}
        >
          <div className="bg-[#48426c] text-center absolute inset-x-0 bottom-0 text-xs font-bold py-1">
            Sajon
          </div>
        </div>

        <img
          src={`${imageBase}8.png`}
          className="w-14 h-14 absolute"
          style={{
            left: "50%",
            top: "-19px",
            transform: "translate(-50%, 0)",
          }}
        />
      </div>
    </div>
  );
}


function TotalBill() {
  return (
    <div className="bg-[#edc08c]  custom-border mt-6 flex p-6 shadow-md">
      <div className="grow">
        <div className="text-[#48426d] font-semibold text-sm"> Total Bill </div>
        <div className="text-[#48426d] font-bold text-xl mt-1"> $750.86 </div>
        <button className="bg-[#48426d] yellow-text font-bold py-4 px-4 mt-3 text-sm custom-border ">
          Split Now
        </button>
      </div>
      <div className="shrink-0 inline-flex flex-col items-center">
        <div className="text-[#48426d] font-bold text-sm"> Split With </div>
        <div className="w-14 h-14 mt-2 relative">
          <div className="absolute inset-x-0 top-0 bg-white flex justify-center rounded-lg shadow-lg">
            <div className="w-9 pt-5 pb-2">
              {splitWith.map((i) => (
                <div
                  key={i}
                  className="w-9 h-9 rounded-full overflow-hidden bg-contain"
                  style={{
                    backgroundImage: `url("${imageBase}${i}.png")`,
                    marginTop: "-6px",
                    padding: "2px",
                    border: "2px solid #fff",
                  }}
                ></div>
              ))}
              <div
                className="w-9 h-9 rounded-full overflow-hidden grid place-items-center"
                style={{
                  background: "#f1aa9b",
                  marginTop: "-6px",
                  padding: "2px",
                  border: "2px solid #fff",
                }}
              >
                <PlusIcon className="size-4" strokeWidth={3} />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}


function PrvSplit() {
  return (
    <div className="bg-[#373258] h-16 mt-6 custom-border flex items-center shadow-md">
      <div className="h-16 w-16 grid place-items-center">
        <div className="h-11 w-11 rounded-full bg-[#48426d] grid place-items-center yellow-text blue-shadow">
          <ExclamationCircleIcon className="size-6" />
        </div>
      </div>
      <div className="ml-1">
        <div className="text-sm font-semibold yellow-text">
          Your previous split
        </div>
        <div className="text-xs mt-1"> $678.56 </div>
      </div>
    </div>
  );
}


const nearbyItems = [
  { name: "Anna", image: "6" },
  { name: "Khalifa", image: "7" },
  { name: "Lisa", image: "9" },
];
const recentItems = [
  { name: "Sing", image: "7" },
  { name: "Alex", image: "3" },
  { name: "Bryan", image: "4" },
  { name: "Mike", image: "2" },
];


function NearbyFriends() {
  return (
    <div className=" mt-6 rounded-3xl relative">
      <svg
        width="264"
        height="224"
        viewBox="0 0 264 224"
        fill="none"
        xmlns="http://www.w3.org/2000/svg"
      >
        <path
          d="M0 84V206C0 216.493 8.50659 225 19 225H245C255.493 225 264 216.493 264 206V19C264 8.50659 255.493 0 245 0H83.1214C72.628 0 64.1214 8.50659 64.1214 19V46C64.1214 56.4934 55.6149 65 45.1214 65H19C8.50659 65 0 73.5066 0 84Z"
          fill="#373258"
        />
      </svg>
      <div className="w-14 h-14 bg-[#edc08c] absolute top-0 left-0 grid place-items-center text-[#48426d] custom-border ">
        <MagnifyingGlassIcon className="w-6 h-6" />
      </div>
      <div className="absolute inset-0 p-4">
        <div className="" style={{ paddingLeft: "64px" }}>
          <div className="flex items-center justify-between text-xs pb-2">
            <div className="yellow-text"> Nearby Friends </div>
            <div className=""> See all </div>
          </div>
          <div className="flex  justify-between ">
            {nearbyItems.map(({ name, image }) => (
              <div
                className="w-12 bg-[#48426d] rounded-full pb-2.5 relative"
                key={name}
              >
                <div className="w-12 h-11 grid place-items-center">
                  <div
                    className="w-8 h-8 rounded-full bg-contain"
                    style={{
                      backgroundImage: `url("${imageBase}${image}.png")`,

                      padding: "2px",
                      border: "2px solid #fff",
                    }}
                  ></div>
                </div>
                <div
                  className="text-center mt-1 font-semibold"
                  style={{ fontSize: "10px" }}
                >
                  {name}
                </div>

                <div
                  className="absolute w-4 h-4 bg-[#cea87d] rounded-full grid place-items-center"
                  style={{
                    left: "50%",
                    bottom: "-12px",
                    transform: "translate(-50%, 0)",
                  }}
                >
                  <PlusIcon className="w-2 h-2" strokeWidth={5} />
                </div>
              </div>
            ))}
          </div>
        </div>

        <div className="text-xs mt-4 mb-2 yellow-text"> Recently Split </div>

        <div className="flex  justify-between ">
          {recentItems.map(({ name, image }) => (
            <div className="w-10" key={name}>
              <div
                className="w-10 h-10 rounded-full bg-contain"
                style={{
                  backgroundImage: `url("${imageBase}${image}.png")`,

                  padding: "2px",
                  border: "2px solid #fff",
                }}
              ></div>
              <div className="text-xs text-center mt-1"> {name} </div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}


function ScreenB() {
  return (
    <Screen className="translate-y-5">
      <SplitNow />
      <Receipt />
      <SliderSet />
      <ConfirmButton />
    </Screen>
  );
}


function SplitNow() {
  return (
    <div className="h-20 rounded-xl flex justify-between items-center ">
      <button className="h-14 w-14 bg-[#373258] rounded-xl yellow-text grid place-items-center shadow-md">
        <ChevronLeftIcon className="w-6 h-6" />
      </button>
      <div className="yellow-text inline-flex items-center">
        <div className="text-lg "> Split Now </div>
        <div className="h-10 w-10 yellow-text grid place-items-center">
          <EllipsisVert.........完整代码请登录后点击上方下载按钮下载查看

网友评论0