@os-design/core
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -7,3 +7,3 @@ import { BaseProps } from '@os-design/styled'; | ||
onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void; | ||
noUnderline?: boolean; | ||
underline?: 'hover' | 'always' | 'never'; | ||
} | ||
@@ -10,0 +10,0 @@ declare const Link: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, LinkProps, { |
@@ -20,16 +20,23 @@ "use strict"; | ||
const UNDERLINE_HEIGHT_EM = 0.1; | ||
const underline = (p) => !p.noUnderline && core_1.css ` | ||
const underlineBase = (p) => core_1.css ` | ||
position: relative; | ||
padding-bottom: 0.02em; | ||
display: inline-block; | ||
&::after { | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
content: ""; | ||
height: ${UNDERLINE_HEIGHT_EM}em; | ||
background-color: rgb(${p.theme.colorPrimary}); | ||
} | ||
${p.darkMode && core_1.css `&::after { background-color: #fff; }`} | ||
`; | ||
const underlineHover = (p) => ['hover', undefined].includes(p.underline) && core_1.css ` | ||
@media (hover: hover) { | ||
position: relative; | ||
padding-bottom: 0.02em; | ||
display: inline-block; | ||
${underlineBase(p)}; | ||
&::after { | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
content: ""; | ||
height: ${UNDERLINE_HEIGHT_EM}em; | ||
background-color: rgb(${p.theme.colorPrimary}); | ||
width: 0; | ||
@@ -44,7 +51,13 @@ opacity: 0; | ||
} | ||
${p.darkMode && core_1.css `&::after { background-color: #fff; }`} | ||
} | ||
`; | ||
const Link = styled_1.default('a', utils_1.omitProps(['darkMode', 'sizing', 'noUnderline'])) ` | ||
const underlineAlways = (p) => p.underline === 'always' && core_1.css ` | ||
${underlineBase(p)}; | ||
&::after { | ||
width: 100%; | ||
opacity: 1; | ||
} | ||
`; | ||
const Link = styled_1.default('a', utils_1.omitProps(['darkMode', 'sizing', 'underline'])) ` | ||
cursor: pointer; | ||
@@ -55,3 +68,4 @@ text-decoration: none; | ||
${darkMode}; | ||
${underline}; | ||
${underlineHover}; | ||
${underlineAlways}; | ||
@@ -58,0 +72,0 @@ ${utils_1.sizing}; |
import React from 'react'; | ||
import { LinkProps } from '../Link'; | ||
export interface LogoContainerProps extends Omit<LinkProps, 'href' | 'onClick' | 'noUnderline'> { | ||
export interface LogoContainerProps extends Omit<LinkProps, 'href' | 'onClick' | 'underline'> { | ||
height: number; | ||
@@ -5,0 +5,0 @@ } |
@@ -18,3 +18,3 @@ "use strict"; | ||
`; | ||
const LogoContainer = props => (react_1.default.createElement(LogoLink, Object.assign({ href: '/', noUnderline: true, "aria-label": 'Logo' }, props), | ||
const LogoContainer = props => (react_1.default.createElement(LogoLink, Object.assign({ href: '/', underline: 'never', "aria-label": 'Logo' }, props), | ||
react_1.default.createElement(Svg, { width: '1024', height: props.height, viewBox: `0 0 1024 ${props.height}` }, | ||
@@ -21,0 +21,0 @@ react_1.default.createElement("g", { transform: `translate(0,${props.height}) scale(0.1,-0.1)`, fill: 'currentColor' }, props.children)))); |
{ | ||
"name": "@os-design/core", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"@emotion/core": "^10.0.22", | ||
"@os-design/icons": "^0.0.8", | ||
"@os-design/icons": "^0.0.9", | ||
"@os-design/styled": "^0.0.4", | ||
@@ -33,3 +33,3 @@ "@os-design/utils": "^0.0.3", | ||
}, | ||
"gitHead": "2fda441928f8bf169c553d306e9ccc47e512beff" | ||
"gitHead": "7ba169f020e8420b5f52a5af4c8f083a3926dfef" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61296
915
+ Added@os-design/icons@0.0.9(transitive)
- Removed@os-design/icons@0.0.8(transitive)
Updated@os-design/icons@^0.0.9