Refactor: Improve docstrings for card class methods (#2938)

This commit is contained in:
Alexandr Garbuzov 2023-07-14 00:42:25 +03:00 committed by GitHub
parent 45f4320008
commit 4eb01d80a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,12 +54,18 @@ class Card {
this.a11yDesc = "";
}
/**
* @returns {void}
*/
disableAnimations() {
this.animations = false;
}
/**
* @param {{title: string, desc: string}} prop
* @param {Object} props The props object.
* @param {string} props.title Accessibility title.
* @param {string} props.desc Accessibility description.
* @returns {void}
*/
setAccessibilityLabel({ title, desc }) {
this.a11yTitle = title;
@ -67,21 +73,24 @@ class Card {
}
/**
* @param {string} value
* @param {string} value The CSS to add to the card.
* @returns {void}
*/
setCSS(value) {
this.css = value;
}
/**
* @param {boolean} value
* @param {boolean} value Whether to hide the border or not.
* @returns {void}
*/
setHideBorder(value) {
this.hideBorder = value;
}
/**
* @param {boolean} value
* @param {boolean} value Whether to hide the title or not.
* @returns {void}
*/
setHideTitle(value) {
this.hideTitle = value;
@ -91,12 +100,16 @@ class Card {
}
/**
* @param {string} text
* @param {string} text The title to set.
* @returns {void}
*/
setTitle(text) {
this.title = text;
}
/**
* @returns {string} The rendered card title.
*/
renderTitle() {
const titleText = `
<text
@ -133,6 +146,9 @@ class Card {
`;
}
/**
* @returns {string} The rendered card gradient.
*/
renderGradient() {
if (typeof this.colors.bgColor !== "object") return "";
@ -156,7 +172,8 @@ class Card {
}
/**
* @param {string} body
* @param {string} body The inner body of the card.
* @returns {string} The rendered card.
*/
render(body) {
return `