mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 15:09:13 +00:00
图片自动阴影
This commit is contained in:
@@ -218,13 +218,14 @@ const BLOG = {
|
||||
ENABLE_RSS: process.env.NEXT_PUBLIC_ENABLE_RSS || true, // 是否开启RSS订阅功能
|
||||
|
||||
// 作废配置
|
||||
AVATAR: process.env.NEXT_PUBLIC_AVATAR || '/avatar.png', // 作者头像,被notion中的ICON覆盖。若无ICON则取public目录下的avatar.png
|
||||
AVATAR: process.env.NEXT_PUBLIC_AVATAR || '/avatar.svg', // 作者头像,被notion中的ICON覆盖。若无ICON则取public目录下的avatar.png
|
||||
TITLE: process.env.NEXT_PUBLIC_TITLE || 'NotionNext BLOG', // 站点标题 ,被notion中的页面标题覆盖
|
||||
HOME_BANNER_IMAGE: process.env.NEXT_PUBLIC_HOME_BANNER_IMAGE || './bg_image.jpg', // 首页背景大图, 会被notion中的封面图覆盖,若无封面图则会使用代码中的 /public/bg_image.jpg 文件
|
||||
DESCRIPTION: process.env.NEXT_PUBLIC_DESCRIPTION || '这是一个由NotionNext生成的站点', // 站点描述,被notion中的页面描述覆盖
|
||||
|
||||
// 网站图片
|
||||
IMG_URL_TYPE: process.env.NEXT_PUBLIC_IMG_TYPE || 'Notion', // ['Notion','AMAZON'] 站点图片前缀 默认 Notion:(https://notion.so/images/xx) , AMAZON(https://s3.us-west-2.amazonaws.com/xxx)
|
||||
IMG_SHADOW: process.env.NEXT_PUBLIC_IMG_SHADOW || false, // 文章图片是否自动添加阴影
|
||||
|
||||
// 开发相关
|
||||
NOTION_ACCESS_TOKEN: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public
|
||||
|
||||
@@ -12,6 +12,12 @@ const ExternalScript = () => {
|
||||
loadExternalResource(BLOG.FONT_AWESOME, 'css')
|
||||
loadExternalResource('/css/custom.css', 'css')
|
||||
loadExternalResource('/js/custom.js', 'js')
|
||||
|
||||
// 自动添加图片阴影
|
||||
if (BLOG.IMG_SHADOW) {
|
||||
loadExternalResource('/css/img-shadow.css', 'js')
|
||||
}
|
||||
|
||||
if (BLOG.CUSTOM_EXTERNAL_JS && BLOG.CUSTOM_EXTERNAL_JS.length > 0) {
|
||||
for (const url of BLOG.CUSTOM_EXTERNAL_JS) {
|
||||
loadExternalResource(url, 'js')
|
||||
|
||||
@@ -100,7 +100,7 @@ export async function getStaticPaths() {
|
||||
const from = 'slug-paths'
|
||||
const { allPages } = await getGlobalNotionData({ from })
|
||||
return {
|
||||
paths: allPages.map(row => ({ params: { slug: [row.slug] } })),
|
||||
paths: allPages?.map(row => ({ params: { slug: [row.slug] } })),
|
||||
fallback: true
|
||||
}
|
||||
}
|
||||
|
||||
11
public/avatar.svg
Normal file
11
public/avatar.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<rect width="200" height="200" fill="#111111"/>
|
||||
<path d="M200.563 83.7392H169V144.594H168.092L126.765 83.7392H99.9706V200H131.534V138.918H132.215L174.223 200H200.563V83.7392Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="200" height="200" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 426 B |
4
public/css/img-shadow.css
Normal file
4
public/css/img-shadow.css
Normal file
@@ -0,0 +1,4 @@
|
||||
/* 图片阴影 */
|
||||
#notion-article img{
|
||||
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import CONFIG_SIMPLE from '../config_simple'
|
||||
*/
|
||||
export const Header = (props) => {
|
||||
const { siteInfo } = props
|
||||
const avatar = siteInfo?.icon || BLOG.AVATAR
|
||||
|
||||
return (
|
||||
<header className="text-center justify-between items-center px-6 bg-white h-80 dark:bg-black relative z-10">
|
||||
@@ -20,7 +21,7 @@ export const Header = (props) => {
|
||||
<div className='flex space-x-6'>
|
||||
<div className='hover:rotate-45 hover:scale-125 transform duration-200 cursor-pointer'>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={siteInfo?.icon} className='rounded-full' width={160} alt={BLOG.AUTHOR} />
|
||||
<img src={avatar} className='rounded-full' width={160} alt={BLOG.AUTHOR} />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user