Skip to content

Commit

Permalink
help.html: more css changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jun 28, 2022
1 parent 3279067 commit df96aba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
28 changes: 4 additions & 24 deletions basis/help/html/html.factor
Expand Up @@ -122,7 +122,7 @@ M: pathname url-of
: fix-css-style ( style -- style' )
R/ font-size: \d+pt;/ [
"font-size: " ?head drop "pt;" ?tail drop
string>number
string>number 2 -
"font-size: %dpt;" sprintf
] re-replace-with

Expand All @@ -136,16 +136,12 @@ M: pathname url-of
drop ""
] re-replace-with

R/ background-color: #f3f2ea;/ [
drop "background-color: #f7f7f7;"
] re-replace-with

R/ font-family: monospace;/ [
" white-space: pre-wrap; line-height: 125%;" append
] re-replace-with

{ "font-family: monospace;" "background-color:" } [ over subseq? ] all? [
" border: 1px solid #dbdbdb; border-radius: 5px; margin: 15px; width: calc(100% - 30px);" append
" border: 1px solid #e3e2db; border-radius: 5px; margin: 10px 0px;" append
] when ;

: fix-help-header ( classes -- classes )
Expand Down Expand Up @@ -179,8 +175,7 @@ M: pathname url-of
{ "#333333;" "#cccccc;" }
{ "#373e48;" "#ffffff;" }
{ "#8b4500;" "orange;" }
{ "#dbdbdb;" "#444444;" }
{ "#e3e2db;" "#666666;" }
{ "#e3e2db;" "#444444;" }
{ "white;" "#202124;" }
{ "black;" "white;" }
} ?at [
Expand All @@ -192,25 +187,10 @@ M: pathname url-of
"{ }" over subseq? [ drop f ] when
] map harvest append "}" suffix ;

: mobile-css ( classes -- classes' )
{ "" "/* Mobile */" "@media screen and (max-width: 600px) {" }
swap [
R/ {[^}]+}/ [
"{" ?head drop "}" ?tail drop ";" split
[ [ blank? ] trim ] map harvest [ ";" append ] map
{ "margin: 15px;" "width: calc(100% - 30px);" } intersect
{ "margin: 15px;" } { "margin: 15px 0px;" } replace
{ "width: calc(100% - 30px);" } { "width: 100%;" } replace
" " join "{ " " }" surround
] re-replace-with " " prepend
"{ }" over subseq? [ drop f ] when
] map harvest append "}" suffix ;

: css-classes ( classes -- stylesheet )
[
[ fix-css-style " { " "}" surround ] [ "." prepend ] bi* prepend
] { } assoc>map fix-help-header dup
[ dark-mode-css ] [ mobile-css ] bi 3append join-lines ;
] { } assoc>map fix-help-header dup dark-mode-css append join-lines ;

:: css-styles-to-classes ( body -- stylesheet body )
H{ } clone :> classes
Expand Down
12 changes: 6 additions & 6 deletions basis/help/html/stylesheet.css
Expand Up @@ -13,7 +13,7 @@ a:hover, .link:hover { text-decoration: underline; }
body {
margin: 0;
font-family: sans-serif;
font-size: 14pt;
font-size: 12pt;
line-height: 150%;
}

Expand Down Expand Up @@ -47,9 +47,9 @@ tr:hover {
}

.navrow {
max-width: 900px;
max-width: 800px;
position: relative;
left: calc(max(-450px,-50%) + 50%);
left: calc(max(-400px,-50%) + 50%);
margin: 0;
padding: 10px 15px 10px 15px;
}
Expand All @@ -59,9 +59,9 @@ tr:hover {
}

.page {
max-width: 900px;
max-width: 800px;
position: relative;
left: calc(max(-450px,-50%) + 50%);
left: calc(max(-400px,-50%) + 50%);
padding: 15px;
}

Expand All @@ -74,7 +74,7 @@ tr:hover {
margin-top: 15px;
border-top: 1px dashed #ccc;
color: #666;
font-size: 12pt;
font-size: 10pt;
}

@media screen and (max-width: 480px) {
Expand Down
4 changes: 2 additions & 2 deletions extra/websites/factorcode/master.css
Expand Up @@ -11,13 +11,13 @@ a:link, a:visited, a:active { text-decoration: none; }
a:hover { text-decoration: underline; }

body {
font-size: 14pt;
font-size: 12pt;
font-family: sans-serif;
text-align: center;
}

.page {
max-width: 900px;
max-width: 800px;
text-align: left;
line-height: 150%;
padding: 10px;
Expand Down

0 comments on commit df96aba

Please sign in to comment.