forked from mirror/chinese-colors
fix: scroll top
This commit is contained in:
parent
ab67986aab
commit
27e46ba59c
@ -35,8 +35,6 @@ const Wrapper = styled.section`
|
|||||||
&.starting {
|
&.starting {
|
||||||
animation: none;
|
animation: none;
|
||||||
transform: initial;
|
transform: initial;
|
||||||
/* html2canvas bug? */
|
|
||||||
/* margin-top: -1rem; */
|
|
||||||
}
|
}
|
||||||
&.img {
|
&.img {
|
||||||
.downloadImg {
|
.downloadImg {
|
||||||
@ -77,10 +75,15 @@ const Wrapper = styled.section`
|
|||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
> h2 {
|
> h2 {
|
||||||
font-size: 0.7rem;
|
font-size: 0.8rem;
|
||||||
|
word-break: keep-all;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
|
.dot {
|
||||||
|
padding: 0 0.4rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.figure {
|
.figure {
|
||||||
@ -115,7 +118,9 @@ const Preview = ({ name, color, figure = 'default.png?width=8rem', closePreview
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<h2>
|
<h2>
|
||||||
{author} ·《{title}》
|
{author}
|
||||||
|
<span className="dot">·</span>
|
||||||
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
@ -109,6 +109,9 @@ const useShareColor = (id = null) => {
|
|||||||
let [setId] = id.split('-');
|
let [setId] = id.split('-');
|
||||||
tmpSet = Colors.find(set => set.id == setId);
|
tmpSet = Colors.find(set => set.id == setId);
|
||||||
tmpColor = tmpSet.colors.find(c => c.id == id);
|
tmpColor = tmpSet.colors.find(c => c.id == id);
|
||||||
|
// 滑动到顶部
|
||||||
|
document.body.scrollTop = 0; // For Safari
|
||||||
|
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||||
}
|
}
|
||||||
console.log('tmp color', tmpSet, tmpColor);
|
console.log('tmp color', tmpSet, tmpColor);
|
||||||
|
|
||||||
@ -135,6 +138,9 @@ const useColor = () => {
|
|||||||
document.title = arr.length > 1 ? `${obj.name} - ${arr[1]}` : `${obj.name} - ${arr[0]}`;
|
document.title = arr.length > 1 ? `${obj.name} - ${arr[1]}` : `${obj.name} - ${arr[0]}`;
|
||||||
let metaThemeColor = document.querySelector('meta[name=theme-color]');
|
let metaThemeColor = document.querySelector('meta[name=theme-color]');
|
||||||
metaThemeColor.setAttribute('content', obj.hex);
|
metaThemeColor.setAttribute('content', obj.hex);
|
||||||
|
// 滑动到顶部
|
||||||
|
document.body.scrollTop = 0; // For Safari
|
||||||
|
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||||
};
|
};
|
||||||
const reducer = (state, action) => {
|
const reducer = (state, action) => {
|
||||||
const { type, payload } = action;
|
const { type, payload } = action;
|
||||||
|
Loading…
Reference in New Issue
Block a user