Загрузка...

Помогите с scss

Тема в разделе Frontend создана пользователем Полковник 3 ноя 2023. 236 просмотров

  1. Полковник
    Полковник Автор темы 3 ноя 2023 1668 21 фев 2022
    как сделать что бы белый блок отображался справа от основного [IMG]


    CSS
    .shortBlock {
    margin-top: 90px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 700px;

    .headerLogo {
    display: flex;
    align-items: center;
    gap: 25px;

    h5 {
    font-family: RoadRadio, sans-serif;
    font-size: 32px;
    font-weight: 600;
    }
    }

    .descriptionShort {
    color: #d1d1d1;
    display: flex;

    p {
    font-family: RoadRadio, sans-serif;
    font-size: 16px;
    }
    }

    .short {
    display: flex;
    gap: 15px;

    input {
    background-color: #fff;
    border: transparent;
    padding: 16px;
    border-radius: 15px;
    width: 100%;
    color: #000;
    font-weight: 400;
    font-size: 16px;
    padding-left: 20px;
    &::placeholder {
    opacity: 0.6; /* Set the opacity to 80% */
    font-weight: 400;
    }
    transition: background-color 0.2s ease-in; /* Smooth transition for background color */
    }

    button {
    font-family: RoadRadio;
    background-color: #fef7bc;
    border: transparent;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 15px;
    color: #f5d31e;
    cursor: pointer;
    transition: background-color 0.2s ease-in, color 0.2s ease-in;
    &:hover {
    background-color: #f5d31e;
    color: #fef7bc;
    }
    }
    }

    .contentShortBlock {
    background-color: #fff;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    opacity: 0; /* Initially set to 0 to hide */
    flex-direction: row;
    height: auto;


    &.slide-in {
    opacity: 1;
    transform: translateY(0);
    height: auto;
    transition: opacity 0.3s ease, transform 0.5s ease; /* Add transition properties */
    }


    transition: opacity 0.3s ease, transform 0.5s ease;

    .leftFlex {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e74c3c;

    img {
    width: 30px;
    }

    a {
    font-weight: 600;
    text-decoration: none;
    color: #34aadc;
    font-family: RoadRadio;
    font-size: 18px;

    }

    }

    .copyShare {
    display: flex;
    align-items: center;
    gap: 15px;

    .copy {
    button {
    display: flex;
    border: none;
    background-color: #fef7bc;
    color: #f5d31e;
    align-items: center;
    padding: 10px 15px;
    border-radius: 10px;
    gap: 10px;
    font-weight: 600;
    font-family: RoadRadio;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */
    &:hover {
    background-color: #f5d31e;
    color: #fef7bc;
    /* SVG path color change */
    + svg path {
    fill: black;
    }
    }
    }
    }

    .share {
    button {
    display: flex;
    border: none;
    background-color: #fef7bc;
    color: #f5d31e;
    align-items: center;
    padding: 10px 15px;
    border-radius: 10px;
    gap: 10px;
    font-weight: 600;
    font-family: RoadRadio;
    cursor: pointer;
    transition: background-color 0.2s ease-in, color 0.2s ease-in; /* Smooth transition for background and text color */
    font-size: 16px;
    &:hover {
    background-color: #f5d31e;
    color: #fef7bc;
    }
    }
    }
    }

    }
    }
    }
    .ShareBlock {
    background-color: #fff;
    border-radius: 15px;
    width: 139px; /* Adjust the width as needed */
    height: 162px; /* Adjust the height as needed */
    }

     
  2. Toil
    Toil 3 ноя 2023 ������� ������ :coder: 3564 18 ноя 2018
    А хтмл мне самому угадывать?
     
  3. Полковник
    Полковник Автор темы 3 ноя 2023 1668 21 фев 2022
    Toil

    JS
    import React, { useEffect, useState, useRef } from "react";
    import QRCodeStyling from "qr-code-styling";
    import Link from "../../assets/images/link.png";
    import Copy from "../../assets/svg/copy.svg";
    import Logo from "../../assets/svg/darkLogo.svg";
    import Share from "../../assets/svg/share.svg";
    import Copied from "../../assets/svg/copied.svg";
    import ShareBlock from "./shareBlock.jsx";

    const LinkItem = ({ link }) => {
    const [copied, setCopied] = useState(false);
    const [isVisible, setIsVisible] = useState(false);
    const qrCodeRef = useRef(null);
    const qrCodeInstanceRef = useRef(null);

    useEffect(() => {
    if (!qrCodeInstanceRef.current) {
    const newQrCodeInstance = new QRCodeStyling({
    width: 120,
    height: 120,
    data: link,
    image: Logo,
    dotsOptions: {
    color: "#fff",
    type: "extra-rounded"
    },
    cornersSquareOptions: {
    type: 'extra-rounded'
    },
    imageOptions: {
    crossOrigin: "anonymous",
    margin: 0
    },
    backgroundOptions: {
    color: '#343434',
    }
    });

    qrCodeInstanceRef.current = newQrCodeInstance;
    newQrCodeInstance.append(qrCodeRef.current);
    setIsVisible(true); // Set the visibility after the QR code instance is created
    } else {
    qrCodeInstanceRef.current.update({ data: link });
    setIsVisible(true); // Set the visibility after the QR code instance is updated
    }
    }, [link]);

    const handleCopyClick = () => {
    navigator.clipboard.writeText(link);
    setCopied(true);
    setTimeout(() => {
    setCopied(false);
    }, 2000);
    };

    return (
    <div>
    <div className={`contentShortBlock ${isVisible ? 'slide-in' : ''}`}>
    <div className="leftFlex">
    <div className="link">
    <img src={Link} alt="" />
    <a href={link}>{link}</a>
    </div>
    <div className="copyShare">
    <div className="copy">
    <button onClick={handleCopyClick}>
    {copied ? 'Скопировано' : 'Копировать'}
    <img src={copied ? Copied : Copy} alt="" />
    </button>
    </div>
    <div className="share">
    <button>
    Поделиться
    <img src={Share} alt="" />
    </button>
    </div>
    </div>
    </div>
    <div className="rightFlex">
    <div className="qrCode" ref={qrCodeRef}></div>
    </div>
    </div>
    <ShareBlock link={link} />
    </div>
    );
    };

    export default LinkItem;


    JS
    import React, {useEffect, useRef, useState} from "react";
    import './styles/short.scss';
    const ShareBlock = ({ link }) => {
    return (
    <div>
    <div className="ShareBlock" />
    </div>
    );
    };

    export default ShareBlock;

     
    1. Посмотреть предыдущие комментарии (2)
    2. Toil
      Полковник, а, бля, я чет не правильно изначально понял. Я думал ты так и хотел сделать. Если ты имел ввиду чтобы белый был справа от элемента с ссылками и qr, то пропиши
      ⁡display: flex;
      ⁡для этого элемента
      [IMG]
    3. Полковник Автор темы
      Toil, [IMG]

      гуд только как теперь сделать что бы основной блок вместо того что бы становится меньше просто отодвигался влево
      3 ноя 2023 Изменено
    4. Toil
      Полковник, так точно не скажу, но можешь попытаться с width поиграться в .contentShortBlock, чтобы оно не становилось меньше
  4. ChatGPT
    ChatGPT 3 ноя 2023 2253 14 мар 2023
    Полковник, чтобы сделать белый блок отображался справа от основного, можно использовать свойство `float` в CSS. В данном случае, нужно добавить следующий код:

    CSS

    .shortBlock {
    float: right;
    }
    Таким образом, блок с классом `.shortBlock` будет выравниваться справа от основного контента. Поместите этот код внутри селектора `.shortBlock` в вашем CSS:

    CSS

    .shortBlock {
    margin-top: 90px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 700px;
    float: right;
    /* остальные стили */
    }
    После этого белый блок будет отображаться справа от основного контента.
     
  5. Монополист
    Монополист 3 ноя 2023 https://lolz.live/threads/8640118/ - обмен всего и вся 9005 6 мар 2021
     
    1. Посмотреть предыдущие комментарии (1)
    2. Полковник Автор темы
    3. Монополист
    4. Полковник Автор темы
  6. byed
    byed 3 ноя 2023 Разработка- https://zelenka.guru/threads/4546710/ 6185 19 апр 2020
    просто flex и тд общему родителю не?
     
  7. hateby
    hateby 3 ноя 2023 18 4 авг 2018
    мне впадлу разгадывать твой код.
    <div class="container">
    <div class="wide-block"> </div>
    <div class="small-square"></div>
    </div>

    .container {
    display:flex;
    flex-direction: column;
    align-items: end;
    width: 100%;
    }
    .wide-block {
    стили...
    }
    small-square {
    стили...
    }
     
    1. hateby
      Полковник, бро ну ты ж както написал то что у тя щас есть.
      тебе надо что бы был общий родитель , и через него задать.
      или прям ща попробуй для твоего квадратика белого margin-left: auto;
Загрузка...
Top