/// /// import { ChildStyle, Style, toCSSText, writeText } from "./deps.ts"; import { generateExternalLinkStyle, generateLinkIconStyle, LinkInit, } from "./stylesheetGenerator.ts"; /** * CSSの生成に使用するオブジェクト */ const externalLinks: LinkInit[] = [{ // PDF url: { url: ".pdf", selectorSyntax: "$=", }, style: { "content": "'\\f1c1'" }, }, { // GitHub url: [ "https://github.com", "https://raw.githubusercontent.com", "https://gist.github.com", ], style: { "content": "'\\f09b'" }, }, { // Twitter url: [ "https://twitter.com", "https://pbs.twimg.com", "https://video.twimg.com", ], style: { "content": "'\\f099'" }, }, { // Wikipedia url: [ "https://ja.wikipedia.org", "https://en.wikipedia.org", ], style: { "content": "'\\f266'" }, }, { // Amazon url: [ "https://www.amazon.co.jp", "https://amazon.co.jp", ], style: { "content": "'\\f270'" }, }, { // Discord url: [ "https://discord.com", "https://discord.app", "https://discordapp.com", "https://discordstatus.com/", ], style: { "content": "'\\f392'" }, }, { // Cloudflare url: [ "https://www.cloudflare.com", "https://cdnjs.cloudflare.com", ], style: { "content": "'\\e07d'" }, }, { // Steam url: [ "https://store.steampowered.com", "https://help.steampowered.com", "https://steamcommunity.com", "https://s.team", ], style: { "content": "'\\f1b6'" }, }, { // Steam外部サービス url: [ // SteamDB "https://steamdb.info", "https://steamstat.us", ], style: { "content": "'\\f3f6'" }, }, { // Googleドライブ url: [ "https://drive.google.com", ], style: { "content": "'\\f3aa'" }, }]; const cssImport = '@import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css";'; const fontFamily: ChildStyle = { "font-family": "'Font Awesome 6 Free', 'Font Awesome 6 Brands'", }; const elStyle: Style = generateExternalLinkStyle(externalLinks, { icon: fontFamily, }); const liStyleBase: ChildStyle = { "font-weight": 400, "margin-right": "1px", }; const liStyle: Style = generateLinkIconStyle(externalLinks, { iconBase: { ...fontFamily, ...liStyleBase }, }); const extraStyle: Style = { // 標準機能のTwitterアイコンを非表示にする "i.fa-twitter::before": { "content": "none", }, ".line .link .favicon.fa-twitter": { "margin": 0, }, }; await writeText( cssImport + toCSSText({ ...elStyle, ...liStyle, ...extraStyle }), );