当前位置: 首页 > news >正文

做网站需要多少带宽wordpress创建注册

做网站需要多少带宽,wordpress创建注册,怎么在网站上做按钮,有没有网站教做美食的项目地址 https://github.com/hismeyy/react-component-100 组件描述 组件适用于展示图片的地方,提供了small,medium,large三种大小。可以删除图片,也可以全屏预览图片。 样式展示 前置依赖 今天我们的这个挑战需要用用到了…

项目地址
https://github.com/hismeyy/react-component-100

组件描述
组件适用于展示图片的地方,提供了small,medium,large三种大小。可以删除图片,也可以全屏预览图片。

样式展示

在这里插入图片描述
在这里插入图片描述

前置依赖

今天我们的这个挑战需要用用到了 react-icons 依赖,因此,我们需要先安装它。

# 使用 npm
npm install react-icons# 或者使用 yarn
yarn add react-icons

使用的话,大家可以看这个网站。大家进去可以找需要的图标。具体使用里面有介绍,非常简单。
react-icons 图标
好了,下面我们展示代码。

代码展示

Img.tsx
import { useState } from 'react'
import './Img.css'
import { MdClose } from 'react-icons/md';interface ImgProps {src: string;alt: string;size?: 'small' | 'medium' | 'large';onClose?: () => void;
}const Img = ({ src, alt, size = 'small', onClose }: ImgProps) => {const [showPreview, setShowPreview] = useState(false);const [visible, setVisible] = useState(true);const handleClose = () => {setVisible(false);if (onClose) {onClose();}};if (!visible) return null;return (<div className={`img-container img-${size}`}><button className={`img-close img-close-${size}`} onClick={handleClose}><MdClose /></button><div className={`img img-${size}`} onClick={() => setShowPreview(true)}><img src={src} alt={alt} /></div>{showPreview && (<div className="img-preview-overlay" onClick={() => setShowPreview(false)}><div className="img-preview-content"><img src={src} alt={alt} /></div></div>)}</div>)
}export default Img
Img.css
.img-container {position: relative;
}.img {overflow: hidden;display: flex;align-items: center;justify-content: center;cursor: pointer;border-radius: 5%;
}.img-small {width: 80px;height: 80px;font-size: 10px;
}.img-medium {width: 160px;height: 160px;font-size: 14px;
}.img-large {width: 240px;height: 240px;font-size: 16px;
}.img img {width: 100%;height: 100%;object-fit: cover;object-position: center;
}.img::after {content: "预 览";display: flex;align-items: center;justify-content: center;color: #fff;position: absolute;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.6);opacity: 0;border-radius: 5%;transition: opacity 0.3s ease;
}.img:hover::after {opacity: 1;
}.img-preview-overlay {position: fixed;top: 0;left: 0;width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.9);display: flex;align-items: center;justify-content: center;z-index: 1000;animation: fadeIn 0.3s ease;
}.img-preview-content {max-width: 90%;max-height: 90vh;position: relative;
}.img-preview-content img {max-width: 100%;max-height: 90vh;object-fit: contain;
}@keyframes fadeIn {from {opacity: 0;}to {opacity: 1;}
}.img-close {all: unset;background-color: rgb(114, 114, 114);border-radius: 50%;color: #fff;font-size: 20px;cursor: pointer;display: flex;align-items: center;justify-content: center;font-weight: bold;position: absolute;transition: all 0.3s ease;z-index: 5;
}.img-close:hover {background-color: rgb(82, 82, 82);transform: scale(1.1);
}.img-close-small {width: 10px;height: 10px;top: -2px;right: -2px;font-size: 10px;
}.img-close-medium {width: 15px;height: 15px;top: -3px;right: -3px;font-size: 15px;
}.img-close-large {width: 20px;height: 20px;top: -5px;right: -5px;font-size: 16px;
}

使用

App.tsx
import './App.css'
import Img from './components/img/img01/Img'function App() {const handleImageClose = () => {console.log('图片被关闭了');};return (<><Imgsrc="https://picsum.photos/500/500"alt="Random image"size="large"onClose={handleImageClose}/></>);
}export default App
http://www.yayakq.cn/news/558814/

相关文章:

  • 郑州金水区做网站公司自动做reference的网站
  • 恶意 镜像网站简述网站开发平台及常用工具
  • 深圳网站建设与网站制作佛山新网站建设怎么样
  • 莱芜网站快排0wordpress
  • 微商城网站建设上海建设摩托车官网
  • 17做网店网站池尾怎样创建网站直播接口
  • 怎么做锅炉网站贵阳网站建设制作方法
  • 上海自适应网站gui界面设计软件
  • 做性的网站网站80端口备案
  • 免费的旅游网站模板南沙规划建设局网站
  • 废橡胶网站建设黄骅港旅游景点大全海边
  • 一级a做爰片免费网站天天看抖音个人主页模板
  • 专业网站建设-好发信息网高端网站开发哪家专业
  • 免费入驻的网站设计平台网站建设文案模板
  • 企业网站货物查询怎么做高端购物网站
  • 天津做优化的网站有多少家织梦网站栏目增加
  • 做网站被捉o2o平台信息表格
  • 小型企业网站建设报告模拟组建过程重庆互联网网站建设
  • 网站ui界面设计广东建设信息网站
  • 东莞市官网网站建设品牌网站如果不备案吗
  • 网站建设结课小论文wordpress商城 淘宝客
  • 中建招聘网站长沙专业网站建设公司哪家好
  • 怎样建英文网站php+网站开发+pdf
  • 徐州建设网站的公司没封的网址免费兄弟
  • 网站文章内容优化方案wordpress 增加页面
  • 网站 用什么语言网站建设前
  • 网站页面大小wordpress 太多重定向
  • 站长素材网站佛山网站推广哪家专业
  • 织梦网站模板简单网站建设设计
  • 宁波高端网站设计公司凯里网站设计