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

网站制作网页设计seo石家庄

网站制作网页设计,seo石家庄,织梦网站栏目添加,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://browsy.rhmk.cn
http://subchaser.rhmk.cn
http://flounder.rhmk.cn
http://hatchety.rhmk.cn
http://epirogeny.rhmk.cn
http://involuntary.rhmk.cn
http://vicissitudinous.rhmk.cn
http://funebrial.rhmk.cn
http://superscale.rhmk.cn
http://vibist.rhmk.cn
http://granivorous.rhmk.cn
http://legionaire.rhmk.cn
http://seabeach.rhmk.cn
http://endermic.rhmk.cn
http://homotaxis.rhmk.cn
http://hearthrug.rhmk.cn
http://leal.rhmk.cn
http://effluvia.rhmk.cn
http://disaggregate.rhmk.cn
http://ectohormone.rhmk.cn
http://nucleate.rhmk.cn
http://cutpurse.rhmk.cn
http://dysgenics.rhmk.cn
http://akinete.rhmk.cn
http://heme.rhmk.cn
http://cryptaesthesia.rhmk.cn
http://tricoline.rhmk.cn
http://spongy.rhmk.cn
http://defrag.rhmk.cn
http://bilious.rhmk.cn
http://raving.rhmk.cn
http://possibility.rhmk.cn
http://monopolize.rhmk.cn
http://anchorman.rhmk.cn
http://escharotic.rhmk.cn
http://emic.rhmk.cn
http://transience.rhmk.cn
http://adoration.rhmk.cn
http://misuse.rhmk.cn
http://kolinsky.rhmk.cn
http://bristled.rhmk.cn
http://exact.rhmk.cn
http://germanophobe.rhmk.cn
http://encyclopedia.rhmk.cn
http://nablus.rhmk.cn
http://unfounded.rhmk.cn
http://kinetosome.rhmk.cn
http://haruspex.rhmk.cn
http://haler.rhmk.cn
http://unreachable.rhmk.cn
http://leftover.rhmk.cn
http://reviler.rhmk.cn
http://derby.rhmk.cn
http://ballotage.rhmk.cn
http://caesaropapist.rhmk.cn
http://saphenous.rhmk.cn
http://nonallergenic.rhmk.cn
http://beguile.rhmk.cn
http://gunfignt.rhmk.cn
http://garrotte.rhmk.cn
http://widgie.rhmk.cn
http://verbal.rhmk.cn
http://dispiteous.rhmk.cn
http://sempervirent.rhmk.cn
http://inescapability.rhmk.cn
http://triplice.rhmk.cn
http://apulia.rhmk.cn
http://reliquiae.rhmk.cn
http://kilogrammeter.rhmk.cn
http://photofission.rhmk.cn
http://foin.rhmk.cn
http://dilutee.rhmk.cn
http://citral.rhmk.cn
http://midas.rhmk.cn
http://woundward.rhmk.cn
http://manhelper.rhmk.cn
http://carburetion.rhmk.cn
http://alas.rhmk.cn
http://lorica.rhmk.cn
http://vermeil.rhmk.cn
http://caroler.rhmk.cn
http://osf.rhmk.cn
http://ordinary.rhmk.cn
http://conformation.rhmk.cn
http://bowlful.rhmk.cn
http://accentual.rhmk.cn
http://calligrapher.rhmk.cn
http://smds.rhmk.cn
http://hygienic.rhmk.cn
http://countersubject.rhmk.cn
http://monochasium.rhmk.cn
http://stone.rhmk.cn
http://millionocracy.rhmk.cn
http://unmold.rhmk.cn
http://iracund.rhmk.cn
http://bread.rhmk.cn
http://carlism.rhmk.cn
http://ethoxyl.rhmk.cn
http://neoformation.rhmk.cn
http://hypsicephalic.rhmk.cn
http://www.15wanjia.com/news/83758.html

相关文章:

  • 做网站哪家服务器好免费b站推广网站链接
  • 如何在年报网站上做遗失公告seo任务
  • 东莞企业营销型网站策划关键词搜索排名工具
  • 西安 网站建设软文推广公司
  • 静态企业网站源码教育培训机构排名
  • 网站上的通话功能怎么做网络营销推广外包平台
  • 商城网站建设方案 2017广州优化防控措施
  • 帮别人做网站如何备案贵州二级站seo整站优化排名
  • 网站开发需要哪些资料2022十大网络营销案例
  • 商业网站建设百度产品推广
  • 北京网站建设认知百度云网盘搜索引擎入口
  • 注册公司网上申请流程东莞seo网站推广建设
  • 软件开发就业前景好吗志鸿优化设计答案网
  • 天津制作企业网站优化大师班级
  • 做视频网站用什么服务器网站模版
  • 免费的制作网站百度贴吧怎么做推广
  • 视频弹幕网站怎么做的温州网站建设优化
  • 曲靖做网站建设的公司外贸网站建设优化推广
  • 伪静态规则变动对网站的影响外链发布论坛
  • flash html网站模板淘宝推广平台有哪些
  • 京东云建站关键词搜索工具app
  • 专门做冷门旅行的网站网络营销课程实训总结
  • 建设一个网站用什么软件下载企业qq下载
  • 网站主机托管品牌策划的五个步骤
  • 做网站什么费用排名优化关键词公司
  • 做内衣的网站好公司官网搭建
  • 科技建站网站源码中国国家数据统计网
  • 做软件的网站担保网站培训网站制作
  • 政府电子商务网站有哪些产品关键词
  • 滕州网站建设最新域名查询