mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 06:50:28 +03:00
add code block language header and improve styles
This commit is contained in:
parent
67b05eeb09
commit
9d37693a21
3 changed files with 119 additions and 96 deletions
|
|
@ -41,16 +41,19 @@ export const BlockQuote = style([
|
|||
]);
|
||||
|
||||
const BaseCode = style({
|
||||
fontFamily: 'monospace',
|
||||
color: color.Secondary.OnContainer,
|
||||
background: color.Secondary.Container,
|
||||
border: `${config.borderWidth.B300} solid ${color.Secondary.ContainerLine}`,
|
||||
color: color.SurfaceVariant.OnContainer,
|
||||
background: color.SurfaceVariant.Container,
|
||||
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
|
||||
borderRadius: config.radii.R300,
|
||||
});
|
||||
const CodeFont = style({
|
||||
fontFamily: 'monospace',
|
||||
});
|
||||
|
||||
export const Code = style([
|
||||
DefaultReset,
|
||||
BaseCode,
|
||||
CodeFont,
|
||||
{
|
||||
padding: `0 ${config.space.S100}`,
|
||||
},
|
||||
|
|
@ -86,34 +89,30 @@ export const CodeBlock = style([
|
|||
{
|
||||
fontStyle: 'normal',
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
]);
|
||||
export const CodeBlockInternal = recipe({
|
||||
base: {
|
||||
padding: `${config.space.S200} ${config.space.S200} 0`,
|
||||
minWidth: toRem(100),
|
||||
},
|
||||
variants: {
|
||||
collapsed: {
|
||||
true: {
|
||||
maxHeight: `calc(${config.lineHeight.T400} * 9.6)`,
|
||||
},
|
||||
},
|
||||
},
|
||||
export const CodeBlockHeader = style({
|
||||
padding: `0 ${config.space.S200} 0 ${config.space.S300}`,
|
||||
borderBottomWidth: config.borderWidth.B300,
|
||||
});
|
||||
export const CodeBlockControls = style({
|
||||
position: 'absolute',
|
||||
top: config.space.S200,
|
||||
right: config.space.S200,
|
||||
visibility: 'hidden',
|
||||
selectors: {
|
||||
[`${CodeBlock}:hover &`]: {
|
||||
visibility: 'visible',
|
||||
},
|
||||
[`${CodeBlock}:focus-within &`]: {
|
||||
visibility: 'visible',
|
||||
},
|
||||
export const CodeBlockInternal = style([
|
||||
CodeFont,
|
||||
{
|
||||
padding: `${config.space.S200} ${config.space.S200} 0`,
|
||||
minWidth: toRem(200),
|
||||
},
|
||||
]);
|
||||
|
||||
export const CodeBlockBottomBar = style({
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
pointerEvents: 'none',
|
||||
|
||||
padding: config.space.S200,
|
||||
background: `linear-gradient(to top, #00000022, #00000000)`,
|
||||
});
|
||||
|
||||
export const List = style([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue