跳到主要内容

浏览器窗口

当你想要在网页中模拟一个浏览器的窗口时,这个组件可以帮到你,当然它是模拟 Mac 系统浏览器的样式。

https://spacexcode.com

Hello World!

Welcome to spacexcode.com

代码实现

import React from 'react';

export default function BrowserWindow(props) {
const url = props.url || 'https://spacexcode.com'
const bodyPad = props.bodyPad || '1rem'
const bodyBg = props.bodyBg || 'transparent'
return (
<div className='browserWindow'>
<div className='header'>
<div className='button'>
<span style={{ background: 'rgb(242, 95, 88)'}}></span>
<span style={{ background: 'rgb(251, 190, 60)'}}></span>
<span style={{ background: 'rgb(88, 203, 66)'}}></span>
</div>
<div className='address'>{url}</div>
<div className='menu'>
<div>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<div className='body' style={{ padding: bodyPad, backgroundColor: bodyBg }}>
{props.children}
</div>
</div>
);
}