Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fix page footer styles
Browse files Browse the repository at this point in the history
Former-commit-id: 8b6c9ea
  • Loading branch information
horacioh committed May 6, 2022
1 parent b8ce0be commit 637e6bf
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 216 deletions.
13 changes: 8 additions & 5 deletions frontend/app/src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const buttonStyles = css({
'$$outlined-border-size': '1px',
fontSize: '$2',
lineHeight: '$1',
paddingHorizontal: '$3',
paddingHorizontal: '$4',
paddingVertical: '$2',
},
2: {
Expand Down Expand Up @@ -58,7 +58,8 @@ export const buttonStyles = css({
},
outlined: {
backgroundColor: 'transparent',
boxShadow: 'inset 0px 0px 0px $$outlined-border-size $$outlined-border-color',
boxShadow:
'inset 0px 0px 0px $$outlined-border-size $$outlined-border-color',
color: '$$outlined-text-color',
'&:hover': {
backgroundColor: '$$outlined-hovered-background-color',
Expand All @@ -80,7 +81,7 @@ export const buttonStyles = css({
},
shape: {
rounded: {
borderRadius: '$2',
borderRadius: '$1',
},
pill: {
borderRadius: '$pill',
Expand Down Expand Up @@ -150,11 +151,13 @@ export const buttonStyles = css({
muted: {
'$$solid-background-color': '$colors$background-contrast',
'$$solid-text-color': '$colors$text-opposite',
'$$solid-hovered-background-color': '$colors$background-contrast-strong',
'$$solid-hovered-background-color':
'$colors$background-contrast-strong',
'$$solid-active-background-color': '$colors$background-opposite',
'$$outlined-border-color': '$colors$background-contrast',
'$$outlined-text-color': '$colors$background-contrast',
'$$outlined-hovered-background-color': '$colors$background-neutral-soft',
'$$outlined-hovered-background-color':
'$colors$background-neutral-soft',
'$$outlined-active-background-color': '$colors$background-neutral',
},
},
Expand Down
44 changes: 44 additions & 0 deletions frontend/app/src/components/page-footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {css, styled} from '@app/stitches.config'

export const footerStyles = css({
background: '$background-alt',
width: '$full',
position: 'absolute',
bottom: 0,
zIndex: '$max',
display: 'flex',
justifyContent: 'space-between',
'&:after': {
content: '',
position: 'absolute',
width: '$full',
height: 20,
background:
'linear-gradient(0deg, $colors$background-alt 0%, rgba(255,255,255,0) 100%)',
top: -20,
left: 0,
},
})
export const footerMetadataStyles = css({
flex: 'none',
background: '$background-alt',
padding: '$5',
display: 'flex',
alignItems: 'center',
})

export const footerButtonsStyles = css({
display: 'flex',
gap: '$5',
padding: '$5',
paddingRight: 0,
alignItems: 'center',
})

export const PageFooterSeparator = styled('div', {
width: 1,
height: '80%',
marginLeft: '$4',
marginRight: '$4',
background: '$background-neutral-strong',
})
1 change: 1 addition & 0 deletions frontend/app/src/components/topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function Topbar() {
}

let title = getDocumentTitle(mainState.context.currentDocument)
console.log('Current Location: ', window.location.pathname)

return (
<TopbarStyled data-tauri-drag-region>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/src/editor/use-editor-draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,6 @@ export function useEditorDraft({ documentId, mainPageService, editor, shouldAuto
return [state, send] as const
}

export function getTitleFromContent(entry: Editor): string {
export function getTitleFromContent(entry: { children: Array<EditorDocument['children']> }): string {
return Node.string(Node.get(entry, [0, 0, 0])) || ''
}
88 changes: 13 additions & 75 deletions frontend/app/src/pages/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import {useMainPage, useParams} from '@app/main-page-context'
import {getDateFormat} from '@app/utils/get-format-date'
import {Box} from '@components/box'
import {Button} from '@components/button'
import {
footerButtonsStyles,
footerMetadataStyles,
footerStyles,
PageFooterSeparator,
} from '@components/page-footer'
import {Text} from '@components/text'
import {ChildrenOf} from '@mintter/mttast'
import {useMemo, useRef, useState} from 'react'
Expand Down Expand Up @@ -200,7 +206,7 @@ export default function EditorPage({
>
<Box data-testid="editor-wrapper">
{context.localDraft?.content && (
<Box css={{}}>
<Box>
<Editor
editor={editor}
value={context.localDraft.content}
Expand All @@ -216,95 +222,27 @@ export default function EditorPage({
toggle Value
</button>
{visible && (
<Box as="pre" css={{}}>
<Box as="pre">
{JSON.stringify(context.localDraft.content, null, 2)}
</Box>
)}
</Box>
</Box>
)}
</Box>
<Box
css={{
background: '$background-alt',
width: '$full',
position: 'absolute',
bottom: 0,
zIndex: '$max',
display: 'flex',
justifyContent: 'space-between',
'&:after': {
content: '',
position: 'absolute',
width: '$full',
height: 20,
background:
'linear-gradient(0deg, $colors$background-alt 0%, rgba(255,255,255,0) 100%)',
top: -20,
left: 0,
},
}}
>
<Box
css={{
flex: 1,
background: '$background-alt',
padding: '$5',
$$gap: '24px',
display: 'flex',
gap: '$$gap',
alignItems: 'center',
'& > span': {
position: 'relative',
},
'& > span:before': {
content: `"|"`,
color: '$text-muted',
position: 'absolute',
right: -15,
top: 0,
},
}}
>
<Box className={footerStyles()}>
<Box className={footerMetadataStyles()}>
<Text size="1" color="muted">
Created on: {getDateFormat(context.localDraft!, 'createTime')}
</Text>
<PageFooterSeparator />
<Text size="1" color="muted">
Last modified: {getDateFormat(context.localDraft!, 'updateTime')}
</Text>
<PageFooterSeparator />
<EditorStatus state={state} />
</Box>
<Box
css={{
display: 'flex',
gap: '$5',
padding: '$5',
paddingRight: 0,
alignItems: 'center',
}}
>
<Button
size="1"
variant="outlined"
disabled={!state.hasTag('canPublish')}
data-testid="submit-review"
onClick={() => {
console.log('Review: IMPLEMENT ME!')
}}
>
Review
</Button>
<Button
variant="outlined"
size="1"
disabled={!state.hasTag('canPublish')}
data-testid="submit-reply"
onClick={() => {
console.log('Reply: IMPLEMENT ME!')
}}
>
Reply
</Button>
<Box className={footerButtonsStyles()}>
<Button
color="success"
size="1"
Expand Down
Loading

0 comments on commit 637e6bf

Please sign in to comment.