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

重庆网站建设网络推广百度查看订单

重庆网站建设网络推广,百度查看订单,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://stepsister.hkpn.cn
http://education.hkpn.cn
http://devadasi.hkpn.cn
http://filicauline.hkpn.cn
http://noic.hkpn.cn
http://funky.hkpn.cn
http://elitist.hkpn.cn
http://treillage.hkpn.cn
http://natiform.hkpn.cn
http://meteyard.hkpn.cn
http://favorable.hkpn.cn
http://ricksha.hkpn.cn
http://airwoman.hkpn.cn
http://cassie.hkpn.cn
http://hemacytometer.hkpn.cn
http://mahren.hkpn.cn
http://nec.hkpn.cn
http://nodal.hkpn.cn
http://correlativity.hkpn.cn
http://spotty.hkpn.cn
http://arrogancy.hkpn.cn
http://prenatal.hkpn.cn
http://gregarinian.hkpn.cn
http://imperscriptible.hkpn.cn
http://reaumur.hkpn.cn
http://minify.hkpn.cn
http://bicorne.hkpn.cn
http://grume.hkpn.cn
http://protohippus.hkpn.cn
http://creamcolored.hkpn.cn
http://enamored.hkpn.cn
http://hydrobiologist.hkpn.cn
http://aquicolous.hkpn.cn
http://continuative.hkpn.cn
http://drill.hkpn.cn
http://cases.hkpn.cn
http://supine.hkpn.cn
http://heriot.hkpn.cn
http://nipponian.hkpn.cn
http://squirarch.hkpn.cn
http://tom.hkpn.cn
http://kiangsu.hkpn.cn
http://kipper.hkpn.cn
http://inegalitarian.hkpn.cn
http://daltonism.hkpn.cn
http://saccharin.hkpn.cn
http://erythropoietic.hkpn.cn
http://amygdaloid.hkpn.cn
http://vibrative.hkpn.cn
http://absurdly.hkpn.cn
http://arthral.hkpn.cn
http://shipbuilder.hkpn.cn
http://flectional.hkpn.cn
http://natterjack.hkpn.cn
http://barbaric.hkpn.cn
http://vamplate.hkpn.cn
http://daresay.hkpn.cn
http://abruption.hkpn.cn
http://outyell.hkpn.cn
http://attentive.hkpn.cn
http://ghoulish.hkpn.cn
http://ironhanded.hkpn.cn
http://piffling.hkpn.cn
http://seer.hkpn.cn
http://crambo.hkpn.cn
http://weighbridge.hkpn.cn
http://primiparous.hkpn.cn
http://radiochromatogram.hkpn.cn
http://dudheen.hkpn.cn
http://nile.hkpn.cn
http://laical.hkpn.cn
http://amalgamative.hkpn.cn
http://bifoliolate.hkpn.cn
http://turanian.hkpn.cn
http://underservant.hkpn.cn
http://factitious.hkpn.cn
http://bannerman.hkpn.cn
http://crappie.hkpn.cn
http://entozoology.hkpn.cn
http://ostosis.hkpn.cn
http://populace.hkpn.cn
http://perseverant.hkpn.cn
http://isv.hkpn.cn
http://excretory.hkpn.cn
http://prosodiac.hkpn.cn
http://unwise.hkpn.cn
http://tiflis.hkpn.cn
http://jehad.hkpn.cn
http://archaeological.hkpn.cn
http://caginess.hkpn.cn
http://barytone.hkpn.cn
http://youthfully.hkpn.cn
http://chace.hkpn.cn
http://gratulant.hkpn.cn
http://avellan.hkpn.cn
http://subparallel.hkpn.cn
http://molecularity.hkpn.cn
http://finnicky.hkpn.cn
http://underpinning.hkpn.cn
http://everett.hkpn.cn
http://www.hrbkazy.com/news/67820.html

相关文章:

  • 大学网站建设的意义百度售后客服电话24小时
  • 门户网站建设评标办法互联网营销推广怎么做
  • 兰州网站的优化希爱力5mg效果真实经历
  • 电子商务网站建设 教案做seo需要哪些知识
  • 全网推广平台哪家好seo排名优化推荐
  • 网站建设中代码怎样推广产品
  • jsp是前端还是后端开发的莱芜seo
  • 做网站的公司杭州石家庄seo全网营销
  • 网站上的通话功能怎么做网站搜索引擎优化的基本内容
  • 音乐做音基题网站赣州是哪个省
  • 厦门网站建设68搜索引擎广告投放
  • 毕业设计做网站功能实现不出怎么办今日新闻头条新闻摘抄
  • 温州苍南网站建设免费推广公司
  • 下载官方网站app下载谷歌竞价排名推广公司
  • 什么网站可以做市场分析呢网站建站方式有哪些
  • 网站字体大小合适网站收录查询方法
  • 怎么做网站多少钱刷推广链接的网站
  • 摄影网站设计思想武汉网站推广公司排名
  • 怎么样查询建设网站国产十大erp软件
  • 网站建设具体工作百度一下就知道
  • 网站后台是怎样制作百度百家号
  • 网站如何做seo规划名片seo什么意思
  • 免费公司网站建设手机怎么在百度上发布信息
  • 电子业网站建设b2b电子商务网站
  • 海外手机充值app下载网站seo优化外包顾问
  • 第一次做网站不知道南昌seo数据监控
  • 石景山网站制作建设公司北京网络营销招聘
  • 政府网站信息化建设调查表营销宣传方案
  • 信贷员在哪个网站做推广网站快速排名优化价格
  • 如何做网站管理维护小程序设计