Rename extraAttributes to attributes.
This commit is contained in:
parent
3cc7d3e6b9
commit
2ef20ca431
|
@ -5,11 +5,11 @@ import {Component, VNode} from 'preact';
|
||||||
* Component properties for {@linkcode ConfirmButton}.
|
* Component properties for {@linkcode ConfirmButton}.
|
||||||
*/
|
*/
|
||||||
export type ConfirmButtonProps = {
|
export type ConfirmButtonProps = {
|
||||||
|
attributes: Record<string, unknown>;
|
||||||
class: string;
|
class: string;
|
||||||
click: (event: MouseEvent) => unknown;
|
click: (event: MouseEvent) => unknown;
|
||||||
confirmClass: string;
|
confirmClass: string;
|
||||||
confirmText: string;
|
confirmText: string;
|
||||||
extraAttributes: Record<string, string>;
|
|
||||||
preventDefault: boolean;
|
preventDefault: boolean;
|
||||||
text: string;
|
text: string;
|
||||||
timeout: number;
|
timeout: number;
|
||||||
|
@ -76,11 +76,7 @@ export class ConfirmButton extends Component<
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<button
|
<button ...${this.props.attributes} ...${props} onclick=${this.click}>
|
||||||
...${this.props.extraAttributes}
|
|
||||||
...${props}
|
|
||||||
onclick=${this.click}
|
|
||||||
>
|
|
||||||
${text}
|
${text}
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import {Component, VNode} from 'preact';
|
||||||
* Component properties for {@linkcode FeedbackButton}.
|
* Component properties for {@linkcode FeedbackButton}.
|
||||||
*/
|
*/
|
||||||
export type FeedbackButtonProps = {
|
export type FeedbackButtonProps = {
|
||||||
|
attributes: Record<string, unknown>;
|
||||||
click: (event: MouseEvent) => unknown;
|
click: (event: MouseEvent) => unknown;
|
||||||
extraAttributes: Record<string, string>;
|
|
||||||
feedbackText: string;
|
feedbackText: string;
|
||||||
text: string;
|
text: string;
|
||||||
timeout: number;
|
timeout: number;
|
||||||
|
@ -60,7 +60,7 @@ export class FeedbackButton extends Component<
|
||||||
|
|
||||||
render(): VNode {
|
render(): VNode {
|
||||||
return html`
|
return html`
|
||||||
<button ...${this.props.extraAttributes} onclick=${this.click}>
|
<button ...${this.props.attributes} onclick=${this.click}>
|
||||||
${this.state.currentText}
|
${this.state.currentText}
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -14,13 +14,13 @@ test('ConfirmButton', async (t) => {
|
||||||
t.plan(3);
|
t.plan(3);
|
||||||
|
|
||||||
const props: ConfirmButtonProps = {
|
const props: ConfirmButtonProps = {
|
||||||
|
attributes: {
|
||||||
|
id: 'confirm-button',
|
||||||
|
},
|
||||||
class: 'button',
|
class: 'button',
|
||||||
click: (event) => t.true(event !== undefined),
|
click: (event) => t.true(event !== undefined),
|
||||||
confirmClass: 'confirm',
|
confirmClass: 'confirm',
|
||||||
confirmText: 'Confirm Button',
|
confirmText: 'Confirm Button',
|
||||||
extraAttributes: {
|
|
||||||
id: 'confirm-button',
|
|
||||||
},
|
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
text: 'Button',
|
text: 'Button',
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
|
|
|
@ -14,10 +14,10 @@ test('FeedbackButton', async (t) => {
|
||||||
t.plan(5);
|
t.plan(5);
|
||||||
|
|
||||||
const props: FeedbackButtonProps = {
|
const props: FeedbackButtonProps = {
|
||||||
click: (event) => t.true(event !== undefined),
|
attributes: {
|
||||||
extraAttributes: {
|
|
||||||
id: 'feedback-button',
|
id: 'feedback-button',
|
||||||
},
|
},
|
||||||
|
click: (event) => t.true(event !== undefined),
|
||||||
feedbackText: 'Feedback Example',
|
feedbackText: 'Feedback Example',
|
||||||
text: 'Example',
|
text: 'Example',
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
|
|
Loading…
Reference in New Issue