separate greentext into "fun text" and make Post/Notification related components

This commit is contained in:
Henry Jameson 2024-02-12 19:17:17 +02:00
parent ae345d2c45
commit 48f106b438
13 changed files with 134 additions and 29 deletions

View File

@ -673,8 +673,6 @@ option {
.faint { .faint {
--text: var(--textFaint); --text: var(--textFaint);
--textGreentext: var(--textGreentextFaint);
--textCyantext: var(--textCyantextFaint);
--link: var(--linkFaint); --link: var(--linkFaint);
color: var(--text); color: var(--text);

View File

@ -0,0 +1,40 @@
export default {
name: 'FunText',
selector: '/*fun-text*/',
virtual: true,
variants: {
greentext: '.greentext',
cyantext: '.cyantext'
},
states: {
faint: '.faint'
},
defaultRules: [
{
directives: {
textColor: '--text',
textAuto: 'preserve'
}
},
{
state: ['faint'],
directives: {
textOpacity: 0.5
}
},
{
variant: 'greentext',
directives: {
textColor: '--cGreen',
textAuto: 'preserve'
}
},
{
variant: 'cyantext',
directives: {
textColor: '--cBlue',
textAuto: 'preserve'
}
}
]
}

View File

@ -0,0 +1,21 @@
export default {
name: 'Notification',
selector: '.Notification',
validInnerComponents: [
'Text',
'Link',
'Icon',
'Border',
'Button',
'ButtonUnstyled',
'RichContent',
'Input'
],
defaultRules: [
{
directives: {
background: '--bg'
}
}
]
}

View File

@ -3,8 +3,7 @@
// TODO Copypaste from Status, should unify it somehow // TODO Copypaste from Status, should unify it somehow
.Notification { .Notification {
border-bottom: 1px solid; border-bottom: 1px solid;
border-color: $fallback--border; border-color: var(--border);
border-color: var(--border, $fallback--border);
word-wrap: break-word; word-wrap: break-word;
word-break: break-word; word-break: break-word;

View File

@ -9,7 +9,9 @@ export default {
'ButtonUnstyled', 'ButtonUnstyled',
'Input', 'Input',
'PanelHeader', 'PanelHeader',
'MenuItem' 'MenuItem',
'Post',
'Notification'
], ],
defaultRules: [ defaultRules: [
{ {

View File

@ -13,7 +13,8 @@ export default {
'ButtonUnstyled', 'ButtonUnstyled',
'Input', 'Input',
'PanelHeader', 'PanelHeader',
'MenuItem' 'MenuItem',
'Post'
], ],
defaultRules: [ defaultRules: [
{ {

View File

@ -0,0 +1,21 @@
export default {
name: 'Post',
selector: '.Status',
validInnerComponents: [
'Text',
'Link',
'Icon',
'Border',
'Button',
'ButtonUnstyled',
'RichContent',
'Input'
],
defaultRules: [
{
directives: {
background: '--bg'
}
}
]
}

View File

@ -0,0 +1,17 @@
export default {
name: 'RichContent',
selector: '.RichContent',
validInnerComponents: [
'Text',
'FunText',
'Link'
],
defaultRules: [
{
directives: {
background: '--bg',
textNoCssColor: 'yes'
}
}
]
}

View File

@ -65,4 +65,12 @@
vertical-align: middle; vertical-align: middle;
object-fit: contain; object-fit: contain;
} }
.greentext {
color: var(--funtextGreentext);
}
.cyantext {
color: var(--funtextCyantext);
}
} }

View File

@ -112,14 +112,6 @@
} }
} }
.greentext {
color: var(--textGreentext);
}
.cyantext {
color: var(--textCyantext);
}
&.-compact { &.-compact {
align-items: top; align-items: top;
flex-direction: row; flex-direction: row;

View File

@ -62,5 +62,15 @@
.StatusContent { .StatusContent {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
&.faint {
.greentext {
color: var(--funtextGreentextFaint);
}
.cyantext {
color: var(--funtextCyantextFaint);
}
}
} }
</style> </style>

View File

@ -2,34 +2,21 @@ export default {
name: 'Text', name: 'Text',
selector: '/*text*/', selector: '/*text*/',
virtual: true, virtual: true,
variants: {
greentext: '.greentext'
},
states: { states: {
faint: '.faint' faint: '.faint'
}, },
defaultRules: [ defaultRules: [
{ {
component: 'Text',
directives: { directives: {
textColor: '--text', textColor: '--text',
textAuto: 'no-preserve' textAuto: 'no-preserve'
} }
}, },
{ {
component: 'Text',
state: ['faint'], state: ['faint'],
directives: { directives: {
textOpacity: 0.5 textOpacity: 0.5
} }
},
{
component: 'Text',
variant: 'greentext',
directives: {
textColor: '--cGreen',
textAuto: 'preserve'
}
} }
] ]
} }

View File

@ -19,9 +19,13 @@ import Button from 'src/components/button.style.js'
import ButtonUnstyled from 'src/components/button_unstyled.style.js' import ButtonUnstyled from 'src/components/button_unstyled.style.js'
import Input from 'src/components/input.style.js' import Input from 'src/components/input.style.js'
import Text from 'src/components/text.style.js' import Text from 'src/components/text.style.js'
import FunText from 'src/components/fun_text.style.js'
import Link from 'src/components/link.style.js' import Link from 'src/components/link.style.js'
import Icon from 'src/components/icon.style.js' import Icon from 'src/components/icon.style.js'
import Border from 'src/components/border.style.js' import Border from 'src/components/border.style.js'
import Post from 'src/components/post.style.js'
import Notification from 'src/components/notification.style.js'
import RichContent from 'src/components/rich_content.style.js'
const DEBUG = false const DEBUG = false
@ -39,6 +43,7 @@ export const DEFAULT_SHADOWS = {
const components = { const components = {
Root, Root,
Text, Text,
FunText,
Link, Link,
Icon, Icon,
Border, Border,
@ -51,7 +56,10 @@ const components = {
TopBar, TopBar,
Button, Button,
ButtonUnstyled, ButtonUnstyled,
Input Input,
Post,
Notification,
RichContent
} }
// "Unrolls" a tree structure of item: { parent: { ...item2, parent: { ...item3, parent: {...} } }} // "Unrolls" a tree structure of item: { parent: { ...item2, parent: { ...item3, parent: {...} } }}
@ -582,6 +590,7 @@ export const init = (extraRuleset, palette) => {
].join(';\n') ].join(';\n')
} }
case 'textColor': { case 'textColor': {
if (rule.directives.textNoCssColor === 'yes') { return '' }
return 'color: ' + v return 'color: ' + v
} }
default: return '' default: return ''
@ -594,7 +603,7 @@ export const init = (extraRuleset, palette) => {
return [ return [
header, header,
directives + ';', directives + ';',
!rule.virtual ? ' color: var(--text);' : '', (!rule.virtual && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
'', '',
virtualDirectives, virtualDirectives,
footer footer