固定ヘッダーを利用しているときに、scrollIntoViewでスクロールした先が隠れてしまう問題を解消する

scroll-margin-top: 70px; これで解決できます。 scroll into view fixed headerでググりました。 https://www.bram.us/2020/03/01/prevent-content-from-being-hidden-underneath-a-fixed-header-by-using-scroll-margin-top/ https://stackoverflow.com/questions/13614112/using-scrollintoview-with-a-fixed-position-header と思いきや、2021年9月現在Safariで動作しないので、以下の記事のように力技で対応する必要がある。辛い。 https://zenn.dev/catnose99/articles/75d3c69bf71bad

September 14, 2021 · 1 min

Dayjsのコンストラクタに渡せる、Date型とか文字列型のUnion型はDayjs側で提供されている

ConfigTypeという型がエクスポートされています。 https://kossy-web-engineer.hatenablog.com/entry/2020/09/01/223101

September 14, 2021 · 1 min

文字列に平行四辺形の下線を引く

ざっと以下のようなコンポーネントを実装するといい。 import { css } from 'linaria'; import { ReactNode } from 'react'; type Props = { children: ReactNode; }; const style = css` display: flex; padding: 4px 0; margin-left: 8px; position: relative; white-space: nowrap; z-index: 1; &:after { content: ''; position: absolute; top: 12px; left: -6px; width: calc(100% + 6px); height: 12px; background: #fdfdfd; transform: skewX(-20deg); z-index: -1; } `; export const Underlined = ({ children }: Props) => { return <span className={style}>{children}</span>; }; ポイント skew transform: skewX(-20deg); これで右方向に少し歪んだ図形が作れる。...

September 14, 2021 · 1 min

overscroll-behavior-x

背景 overscroll-behavior-x https://developer.mozilla.org/ja/docs/Web/CSS/overscroll-behavior-x X軸方向にスクロールしたとき、要素の両端に到達したときブラウザ標準の挙動を引き起こさないために指定する

September 14, 2021 · 1 min

CSSアニメーションの動きをベジエ曲線にする

ease-in-outみたいなデフォルトの動きでは満足しなくなってきたときに使える。 animation-timing-function: cubic-bezier(0.71, 0.35, 1, -0.6); こちらのサイトでシミュレーションできる https://cubic-bezier.com/#.17,.67,.83,.67

September 14, 2021 · 1 min

composerで公開されていないライブラリをGitHubから直接利用する

https://getcomposer.org/doc/05-repositories.md#package-2 { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "https://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" }, "autoload": { "classmap": ["libs/"] } } } ], "require": { "smarty/smarty": "3.1.*" } }

September 13, 2021 · 1 min