Commit fd859db1 authored by Raphael's avatar Raphael

html standing rules!

header component for convenience
parent 4cb0edc6
Pipeline #60432775 passed with stages
in 2 minutes and 20 seconds
import React from 'react'
const h = React.createElement
const d = '.'
export function createHeader({
prefixes = [],
suffixes = ['.'],
separator = '.',
show = true,
}){
const show_slice = show ? 0 : -1
return function H({children, className, id}){
const ids = id.split(separator)
const level = Math.min(ids.length, 6) - 1
const prefix = prefixes[level] || ''
const suffix = suffixes[level] || ''
return (
h('h'+(level+1),
{
id:'S'+id,
className,
},
<a href={'#S'+id}>
{[
prefix +
ids.slice(show_slice).join(separator) +
suffix,
children && [' ', children],
]}
</a>
)
)
}
}
......@@ -27,14 +27,15 @@ body {
display:flex;
flex-direction:column;
}
h1, h2, h3 {
h1, h2, h3, h4 {
font-weight: normal;
margin: 0 1rem;
}
h1, .h1 { font-size: 2rem; }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }
p, .p, h1, h2, h3, dl, input, label, ol, pre, table, textarea, ul {
h4, .h4 { font-size: 1.125rem; }
p, .p, h1, h2, h3, h4, dl, input, label, ol, pre, table, textarea, ul {
line-height: 1.5;
}
p, .p, dl, ol, pre, table, ul {
......@@ -269,23 +270,27 @@ input:invalid {
page-break-inside: avoid;
}
.legal h1 a, .legal h2 a, .legal h3 a {
.legal h1 a, .legal h2 a, .legal h3 a, .legal h4 a {
background: 0;
color: #000;
display: block;
}
.legal h1 a:hover, .legal h2 a:hover, .legal h3 a:hover {
.legal h1 a:hover, .legal h2 a:hover, .legal h3 a:hover, .legal h4 a:hover {
background: 0;
}
.legal h1 + p, .legal h2 + p, .legal h3 + p {
.legal h1 + p, .legal h2 + p, .legal h3 + p, .legal h4 + p {
margin-top: 0;
}
.legal h3 {
.legal h3, .legal h4 {
float: left;
font-size: 1rem;
font-weight: bold;
margin: 0rem .5rem 0 1rem;
}
.legal .block {
float: none;
padding: inherit;
}
table {border-collapse: collapse;}
th {text-align: left;}
td, th {border: 1px solid;}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment