Skip to content

Commit

Permalink
Add option to keep un-ticked items when archiving, use global styles …
Browse files Browse the repository at this point in the history
…for forms and buttons (#28)
  • Loading branch information
davidje13 committed Dec 20, 2024
1 parent 406793a commit 22ae8ee
Show file tree
Hide file tree
Showing 38 changed files with 347 additions and 509 deletions.
10 changes: 6 additions & 4 deletions frontend/src/actions/retro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ export const deleteRetroItem = (itemId: string): Spec<Retro>[] => [
{ items: ['delete', ['all', { id: ['=', itemId] }]] },
];

export const clearCovered = (): Spec<Retro>[] => [
export const clearCovered = (preserveNotDone: boolean): Spec<Retro>[] => [
{
state: ['=', {}],
groupStates: ['=', {}],
items: [
'seq',
'delete',
[
'delete',
['all', ['or', { category: ['!=', 'action'] }, { doneTime: ['>', 0] }]],
'all',
preserveNotDone
? { doneTime: ['>', 0] }
: ['or', { category: ['!=', 'action'] }, { doneTime: ['>', 0] }],
],
],
},
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/App.less
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
@import (reference) './colours.less';
@import './opensans.less';
@import './global-styles/opensans.less';
@import './global-styles/form.less';
@import './global-styles/button.less';

body,
input,
textarea,
button {
button,
dialog {
font:
300 1em 'Open Sans',
300 1em / 1.4 'Open Sans',
sans-serif;
line-height: 1.4;
}

article {
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/attachments/giphy/GiphyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { type RetroItemAttachment } from '../../../shared/api-entities';
import { useEvent } from '../../../hooks/useEvent';
import { useBoolean } from '../../../hooks/useBoolean';
import { Popup } from '../../common/Popup';
import { WrappedButton } from '../../common/WrappedButton';
import { GiphyPopup } from './GiphyPopup';

interface PropsT {
Expand All @@ -21,8 +20,8 @@ export const GiphyButton = memo(

return (
<>
<WrappedButton
key="giphy"
<button
type="button"
title="Add GIPHY image"
className="open-giphy"
onClick={visible.setTrue}
Expand Down
28 changes: 0 additions & 28 deletions frontend/src/components/attachments/giphy/GiphyPopup.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@
padding: 8px 16px;
flex: 1;
}

button {
margin: 0 0 0 8px;
padding: 8px 16px;
background: #eeeeee;
color: @green-text-on-white;
transition: box-shadow 0.2s ease;

&:hover {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

&:active {
box-shadow: none;
}
}
}

.credit {
Expand Down Expand Up @@ -77,17 +61,5 @@

.dialog-options button {
margin: 0 16px;
padding: 8px 16px;
background: #eeeeee;
color: @green-text-on-white;
transition: box-shadow 0.2s ease;

&:hover {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

&:active {
box-shadow: none;
}
}
}
24 changes: 15 additions & 9 deletions frontend/src/components/attachments/giphy/GiphyPopup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { useState, memo } from 'react';
import useAwaited from 'react-hook-awaited';
import { type RetroItemAttachment } from '../../../shared/api-entities';
import { WrappedButton } from '../../common/WrappedButton';
import { Input } from '../../common/Input';
import { giphyService } from '../../../api/api';
import './GiphyPopup.less';

Expand All @@ -22,12 +20,15 @@ export const GiphyPopup = memo(
);

const deleteButton = defaultAttachment ? (
<WrappedButton onClick={() => onConfirm(null)}>Remove</WrappedButton>
<button type="button" onClick={() => onConfirm(null)}>
Remove
</button>
) : null;

const optionElements = options.latestData?.map(({ small, medium }) => (
<WrappedButton
<button
key={medium}
type="button"
onClick={() => onConfirm({ type: 'giphy', url: medium })}
>
<img
Expand All @@ -36,7 +37,7 @@ export const GiphyPopup = memo(
crossOrigin="anonymous"
referrerPolicy="no-referrer"
/>
</WrappedButton>
</button>
));

return (
Expand All @@ -47,13 +48,16 @@ export const GiphyPopup = memo(
setAppliedQuery(query);
}}
>
<Input
<input
type="text"
value={query}
placeholder="Enter a search term"
onChange={setQuery}
onChange={(e) => setQuery(e.currentTarget.value)}
autoComplete="off"
/>
<button type="submit">Search</button>
<button type="submit" className="global-button primary">
Search
</button>
</form>
<p className="credit">
Powered By{' '}
Expand All @@ -68,7 +72,9 @@ export const GiphyPopup = memo(
<p className="choices">{optionElements}</p>
<p className="dialog-options">
{deleteButton}
<WrappedButton onClick={onCancel}>Cancel</WrappedButton>
<button type="button" className="global-button" onClick={onCancel}>
Cancel
</button>
</p>
</div>
);
Expand Down
22 changes: 10 additions & 12 deletions frontend/src/components/common/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ import Warning from '../../../resources/warning.svg';
import './Alert.less';

interface PropsT {
show?: boolean;
warning?: boolean;
message?: string | undefined;
children?: ReactNode;
message?: ReactNode | undefined;
suffix?: ReactNode;
}

export const Alert = memo(
({ show, warning = false, message, children }: PropsT) =>
show !== false && (message || children) ? (
<div className={`alert-message ${warning ? 'warning' : 'error'}`}>
<Warning title={warning ? 'Warning' : 'Error'} />
{message}
{children}
</div>
) : null,
export const Alert = memo(({ warning = false, message, suffix }: PropsT) =>
message ? (
<div className={`alert-message ${warning ? 'warning' : 'error'}`}>
<Warning title={warning ? 'Warning' : 'Error'} />
{message}
{suffix}
</div>
) : null,
);
5 changes: 2 additions & 3 deletions frontend/src/components/common/HeaderLinkItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { memo, HTMLAttributes } from 'react';
import { Link } from 'wouter';
import { WrappedButton } from './WrappedButton';

export interface LinkPropsT
extends Omit<HTMLAttributes<HTMLElement>, 'onClick'> {
Expand All @@ -19,9 +18,9 @@ export const HeaderLinkItem = memo(
}

return (
<WrappedButton onClick={action} {...props}>
<button type="button" onClick={action} {...props}>
{label}
</WrappedButton>
</button>
);
},
);
68 changes: 0 additions & 68 deletions frontend/src/components/common/Input.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions frontend/src/components/common/WrappedButton.tsx

This file was deleted.

30 changes: 30 additions & 0 deletions frontend/src/components/global-styles/button.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@import (reference) '../colours.less';

.global-button {
display: inline-block;
padding: 8px 16px;
background: #eeeeee;
color: @green-text-on-white;
transition: box-shadow 0.2s ease;
text-align: center;

&:hover,
&:focus {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
text-decoration: none;
}

&:active {
box-shadow: none;
text-decoration: none;
}

&.primary {
background: @green-button-dark;
color: #ffffff;
}

&:disabled {
background: @beige-shadow;
}
}
Loading

0 comments on commit 22ae8ee

Please sign in to comment.