fix(advanced checklist): improve editor styles (#1221)

This commit is contained in:
Johnny A
2022-07-06 17:27:22 -04:00
committed by GitHub
parent bfba5b8d4f
commit f7ba6588a7
13 changed files with 27 additions and 28 deletions

View File

@@ -23,7 +23,8 @@
}, },
"dependencies": { "dependencies": {
"@standardnotes/features": "workspace:*", "@standardnotes/features": "workspace:*",
"@standardnotes/styles": "workspace:*" "@standardnotes/styles": "workspace:*",
"@standardnotes/utils": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@standardnotes/deterministic-zip": "^1.2.0", "@standardnotes/deterministic-zip": "^1.2.0",

View File

@@ -79,6 +79,9 @@
"^.+\\.module\\.(css|sass|scss)$" "^.+\\.module\\.(css|sass|scss)$"
] ]
}, },
"dependencies": {
"@standardnotes/utils": "workspace:*"
},
"devDependencies": { "devDependencies": {
"@reach/alert-dialog": "0.16.2", "@reach/alert-dialog": "0.16.2",
"@reach/menu-button": "0.16.2", "@reach/menu-button": "0.16.2",
@@ -87,7 +90,6 @@
"@reduxjs/toolkit": "1.8.0", "@reduxjs/toolkit": "1.8.0",
"@standardnotes/editor-kit": "2.2.5", "@standardnotes/editor-kit": "2.2.5",
"@standardnotes/stylekit": "5.23.0", "@standardnotes/stylekit": "5.23.0",
"@standardnotes/utils": "workspace:*",
"@testing-library/dom": "8.11.3", "@testing-library/dom": "8.11.3",
"@testing-library/jest-dom": "5.16.2", "@testing-library/jest-dom": "5.16.2",
"@testing-library/react": "12.1.4", "@testing-library/react": "12.1.4",

View File

@@ -45,7 +45,7 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
<p className="color-foreground">{children}</p> <p className="color-foreground">{children}</p>
</AlertDialogDescription> </AlertDialogDescription>
<div className="flex my-1 mt-4"> <div className="flex my-1">
<button <button
data-testid="cancel-dialog-button" data-testid="cancel-dialog-button"
className="sn-button small neutral" className="sn-button small neutral"

View File

@@ -2,6 +2,7 @@ import styled from 'styled-components'
export const SubTitle = styled.h3` export const SubTitle = styled.h3`
color: var(--sn-stylekit-foreground-color); color: var(--sn-stylekit-foreground-color);
cursor: pointer;
font-size: var(--sn-stylekit-font-size-h3); font-size: var(--sn-stylekit-font-size-h3);
font-weight: 500; font-weight: 500;
margin: 10px 0px; margin: 10px 0px;

View File

@@ -2,7 +2,7 @@ $transition-duration: 750ms;
.checkbox-container { .checkbox-container {
display: block; display: block;
padding-left: 20px; padding-left: 22px;
position: relative; position: relative;
&:last-child { &:last-child {
@@ -22,17 +22,16 @@ $transition-duration: 750ms;
.checkbox-button { .checkbox-button {
bottom: 0; bottom: 0;
cursor: pointer; cursor: pointer;
fill: none; fill: var(--sn-stylekit-contrast-background-color);
height: 19px; height: 18px;
left: 0; left: 0;
margin: auto; margin: auto;
position: absolute; position: absolute;
stroke-linecap: round; stroke-linecap: round;
stroke-linejoin: round; stroke-linejoin: round;
stroke-width: 2; stroke-width: 1;
stroke: var(--sn-stylekit-neutral-color);
top: 0; top: 0;
width: 19px; width: 18px;
} }
.align-baseline { .align-baseline {
@@ -60,8 +59,9 @@ $transition-duration: 750ms;
.checkbox-square { .checkbox-square {
stroke-dasharray: 56.1053, 56.1053; stroke-dasharray: 56.1053, 56.1053;
stroke-dashoffset: 0; stroke-dashoffset: 0;
stroke: var(--sn-stylekit-neutral-color); stroke: var(--sn-stylekit-shadow-color);
transition-delay: $transition-duration * 0.2; transition-delay: $transition-duration * 0.2;
fill: var(--sn-stylekit-contrast-background-color);
} }
.checkbox-mark { .checkbox-mark {

View File

@@ -30,7 +30,7 @@ const MigrateLegacyContent: React.FC = () => {
Are you sure you want to migrate legacy content to the new format? Are you sure you want to migrate legacy content to the new format?
</AlertDialogLabel> </AlertDialogLabel>
<div className="flex my-1 mt-4"> <div className="flex my-1">
<button className="sn-button small neutral" onClick={handleCancel} ref={cancelRef}> <button className="sn-button small neutral" onClick={handleCancel} ref={cancelRef}>
Cancel Cancel
</button> </button>

View File

@@ -18,7 +18,7 @@ const TaskGroupContainer = styled.div<{ isLast?: boolean }>`
border: 1px solid var(--sn-stylekit-border-color); border: 1px solid var(--sn-stylekit-border-color);
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
padding: 16px; padding: 16px 18px;
margin-bottom: ${({ isLast }) => (!isLast ? '9px' : '0px')}; margin-bottom: ${({ isLast }) => (!isLast ? '9px' : '0px')};
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
@@ -83,7 +83,7 @@ const TaskGroup: React.FC<TaskGroupProps> = ({
onTransitionEnd={onTransitionEnd} onTransitionEnd={onTransitionEnd}
isLast={isLast} isLast={isLast}
> >
<div className="flex items-center justify-between h-8 mt-1 mb-1"> <div className="flex items-center justify-between h-8">
<div className="flex flex-grow items-center" onClick={handleClick}> <div className="flex flex-grow items-center" onClick={handleClick}>
<MainTitle crossed={allTasksCompleted && collapsed} highlight={isDragging} {...props}> <MainTitle crossed={allTasksCompleted && collapsed} highlight={isDragging} {...props}>
{groupName} {groupName}

View File

@@ -60,7 +60,7 @@ it('renders the completed tasks section', () => {
const completedTasksSection = screen.getByTestId('completed-tasks-section') const completedTasksSection = screen.getByTestId('completed-tasks-section')
expect(completedTasksSection).toBeInTheDocument() expect(completedTasksSection).toBeInTheDocument()
expect(completedTasksSection).toHaveTextContent('Completed tasks') expect(completedTasksSection).toHaveTextContent('Completed')
const taskItems = within(completedTasksSection).getAllByTestId('task-item') const taskItems = within(completedTasksSection).getAllByTestId('task-item')
expect(taskItems).toHaveLength(1) expect(taskItems).toHaveLength(1)
@@ -100,7 +100,7 @@ it('renders default sections', () => {
const completedTasksSection = screen.getByTestId('completed-tasks-section') const completedTasksSection = screen.getByTestId('completed-tasks-section')
expect(completedTasksSection).toBeInTheDocument() expect(completedTasksSection).toBeInTheDocument()
expect(completedTasksSection).toHaveTextContent('Completed tasks') expect(completedTasksSection).toHaveTextContent('Completed')
const taskItems = within(completedTasksSection).getAllByTestId('task-item') const taskItems = within(completedTasksSection).getAllByTestId('task-item')
expect(taskItems).toHaveLength(1) expect(taskItems).toHaveLength(1)

View File

@@ -6,10 +6,9 @@ import { CSSTransition, TransitionGroup } from 'react-transition-group'
import styled from 'styled-components' import styled from 'styled-components'
import { useAppDispatch, useAppSelector, usePrevious } from '../../app/hooks' import { useAppDispatch, useAppSelector, usePrevious } from '../../app/hooks'
import { RoundButton, SubTitle } from '../../common/components' import { SubTitle } from '../../common/components'
import { SectionModel, TaskModel, tasksGroupCollapsed } from './tasks-slice' import { SectionModel, TaskModel, tasksGroupCollapsed } from './tasks-slice'
import { ChevronDownIcon, ChevronUpIcon } from '../../common/components/icons'
import TaskItem from './TaskItem' import TaskItem from './TaskItem'
const SectionHeader = styled.div` const SectionHeader = styled.div`
@@ -26,7 +25,7 @@ const InnerTasksContainer = styled.div`
flex-direction: column; flex-direction: column;
& > *:not(:last-child) { & > *:not(:last-child) {
margin-bottom: 7px; margin-bottom: 9px;
} }
` `
@@ -101,12 +100,7 @@ const TasksSection: React.FC<TasksSectionProps> = ({ groupName, tasks, section,
{(provided) => ( {(provided) => (
<Wrapper> <Wrapper>
<SectionHeader> <SectionHeader>
<SubTitle>{section.name}</SubTitle> <SubTitle onClick={handleCollapse}>{section.name}</SubTitle>
{tasks.length > 0 && (
<RoundButton onClick={handleCollapse} size="small">
{!collapsed ? <ChevronUpIcon /> : <ChevronDownIcon />}
</RoundButton>
)}
</SectionHeader> </SectionHeader>
{!collapsed && ( {!collapsed && (
<InnerTasksContainer <InnerTasksContainer

View File

@@ -5,11 +5,11 @@ export const LATEST_SCHEMA_VERSION = '1.0.0'
export const DEFAULT_SECTIONS: SectionModel[] = [ export const DEFAULT_SECTIONS: SectionModel[] = [
{ {
id: 'open-tasks', id: 'open-tasks',
name: 'Open tasks', name: 'Open',
}, },
{ {
id: 'completed-tasks', id: 'completed-tasks',
name: 'Completed tasks', name: 'Completed',
}, },
] ]

View File

@@ -85,7 +85,7 @@ body {
left: 0; left: 0;
height: 10px; height: 10px;
width: 10px; width: 10px;
border-radius: 1px; border-radius: 10px;
background-color: var(--sn-stylekit-contrast-background-color);; background-color: var(--sn-stylekit-contrast-background-color);;
border: 1px solid var(--sn-stylekit-contrast-border-color); border: 1px solid var(--sn-stylekit-contrast-border-color);

View File

@@ -8,7 +8,7 @@ import { FillEditorComponentDefaults } from './Utilities/FillEditorComponentDefa
export function experimentalFeatures(): FeatureDescription[] { export function experimentalFeatures(): FeatureDescription[] {
const advancedChecklist: EditorFeatureDescription = FillEditorComponentDefaults({ const advancedChecklist: EditorFeatureDescription = FillEditorComponentDefaults({
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan], availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
name: 'Advanced Checklist [Alpha]', name: 'Advanced Checklist [Beta]',
identifier: FeatureIdentifier.AdvancedChecklist, identifier: FeatureIdentifier.AdvancedChecklist,
note_type: NoteType.Task, note_type: NoteType.Task,
spellcheckControl: true, spellcheckControl: true,

View File

@@ -6403,6 +6403,7 @@ __metadata:
"@standardnotes/eslint-config-extensions": ^1.0.4 "@standardnotes/eslint-config-extensions": ^1.0.4
"@standardnotes/features": "workspace:*" "@standardnotes/features": "workspace:*"
"@standardnotes/styles": "workspace:*" "@standardnotes/styles": "workspace:*"
"@standardnotes/utils": "workspace:*"
copy-webpack-plugin: ^11.0.0 copy-webpack-plugin: ^11.0.0
mini-css-extract-plugin: ^2.6.0 mini-css-extract-plugin: ^2.6.0
minimatch: ^5.1.0 minimatch: ^5.1.0