| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { |
| 3 |
generateTypographyAttributes, |
| 4 |
generateResponsiveRangeAttributes, |
| 5 |
generateDimensionsAttributes, |
| 6 |
generateBackgroundAttributes, |
| 7 |
generateBorderShadowAttributes, |
| 8 |
} from '../../../util/helpers' |
| 9 |
|
| 10 |
import { |
| 11 |
GRID_BACKGROUND, |
| 12 |
GRID_BORDER, |
| 13 |
GRID_MARGIN, |
| 14 |
GRID_PADDING, |
| 15 |
TITLE_MARGIN, |
| 16 |
TITLE_PADDING, |
| 17 |
TITLE_BACKGROUND, |
| 18 |
TITLE_BORDER, |
| 19 |
COLUMNS, |
| 20 |
GRID_SPACE, |
| 21 |
COUNT_SIZE, |
| 22 |
COUNT_BACKGROUND, |
| 23 |
COUNT_BORDER, |
| 24 |
LIST_MARGIN, |
| 25 |
LIST_PADDING, |
| 26 |
LIST_BACKGROUND, |
| 27 |
ICON_SIZE, |
| 28 |
ICON_MARGIN, |
| 29 |
BTN_MARGIN, |
| 30 |
BTN_PADDING, |
| 31 |
BTN_BACKGROUND, |
| 32 |
BTN_BORDER, |
| 33 |
WRAPPER_MARGIN, |
| 34 |
CONTAINER_SECTION_MARGIN, |
| 35 |
CONTAINER_SECTION_PADDING, |
| 36 |
CONTAINER_SECTION_BACKGROUND, |
| 37 |
ICON_HEIGHT, |
| 38 |
ICON_WIDTH, |
| 39 |
COUNT_BACKGROUND_LAYOUT_2, |
| 40 |
COUNT_PADDING_LAYOUT_2, |
| 41 |
COUNT_MARGIN_LAYOUT_2, |
| 42 |
TITLE_PADDING_LAYOUT_2, |
| 43 |
TITLE_MARGIN_LAYOUT_2 |
| 44 |
} from './constants' |
| 45 |
import * as typoPrefixs from './typographyPrefixConstants' |
| 46 |
|
| 47 |
const attributes = { |
| 48 |
// the following 4 attributes is must required for responsive options and asset generation for frontend |
| 49 |
// responsive control attributes ⬇ |
| 50 |
resOption: { |
| 51 |
type: 'string', |
| 52 |
default: 'Desktop', |
| 53 |
}, |
| 54 |
// blockId attribute for making unique className and other uniqueness ⬇ |
| 55 |
blockId: { |
| 56 |
type: 'string', |
| 57 |
}, |
| 58 |
blockRoot: { |
| 59 |
type: 'string', |
| 60 |
default: 'better_docs', |
| 61 |
}, |
| 62 |
// blockMeta is for keeping all the styles ⬇ |
| 63 |
blockMeta: { |
| 64 |
type: 'object', |
| 65 |
}, |
| 66 |
selectKB: { |
| 67 |
type: 'string', |
| 68 |
default: null, |
| 69 |
}, |
| 70 |
includeCategories: { |
| 71 |
type: 'string', |
| 72 |
default: null, |
| 73 |
}, |
| 74 |
excludeCategories: { |
| 75 |
type: 'string', |
| 76 |
}, |
| 77 |
gridPerPage: { |
| 78 |
type: 'number', |
| 79 |
default: 9, |
| 80 |
}, |
| 81 |
orderBy: { |
| 82 |
type: 'string', |
| 83 |
default: 'doc_category_order', |
| 84 |
}, |
| 85 |
order: { |
| 86 |
type: 'string', |
| 87 |
default: 'asc', |
| 88 |
}, |
| 89 |
listIconImageUrl: { |
| 90 |
type: 'string', |
| 91 |
default: '', |
| 92 |
}, |
| 93 |
postsPerPage: { |
| 94 |
type: 'number', |
| 95 |
default: 5, |
| 96 |
}, |
| 97 |
postsOrderBy: { |
| 98 |
type: 'string', |
| 99 |
default: 'betterdocs_order', |
| 100 |
}, |
| 101 |
postsOrder: { |
| 102 |
type: 'string', |
| 103 |
default: 'asc', |
| 104 |
}, |
| 105 |
enableNestedSubcategory: { |
| 106 |
type: 'boolean', |
| 107 |
default: false, |
| 108 |
}, |
| 109 |
enableLazyLoad: { |
| 110 |
type: 'boolean', |
| 111 |
default: false, |
| 112 |
}, |
| 113 |
postPerSubcategory: { |
| 114 |
type: 'number', |
| 115 |
default: 3, |
| 116 |
}, |
| 117 |
subCategoryPerGrid:{ |
| 118 |
type: 'number', |
| 119 |
default: 2, |
| 120 |
}, |
| 121 |
layout: { |
| 122 |
type: 'string', |
| 123 |
default: 'default', |
| 124 |
}, |
| 125 |
layoutMode: { |
| 126 |
type: 'string', |
| 127 |
default: 'grid', |
| 128 |
}, |
| 129 |
showIcon: { |
| 130 |
type: 'boolean', |
| 131 |
default: true, |
| 132 |
}, |
| 133 |
showTitle: { |
| 134 |
type: 'boolean', |
| 135 |
default: true, |
| 136 |
}, |
| 137 |
titleTag: { |
| 138 |
type: 'string', |
| 139 |
default: 'h2', |
| 140 |
}, |
| 141 |
showHeader: { |
| 142 |
type: 'boolean', |
| 143 |
default: true, |
| 144 |
}, |
| 145 |
showCount: { |
| 146 |
type: 'boolean', |
| 147 |
default: true, |
| 148 |
}, |
| 149 |
showList: { |
| 150 |
type: 'boolean', |
| 151 |
default: true, |
| 152 |
}, |
| 153 |
showButton: { |
| 154 |
type: 'boolean', |
| 155 |
default: true, |
| 156 |
}, |
| 157 |
buttonText: { |
| 158 |
type: 'string', |
| 159 |
default: __('Explore More', 'betterdocs'), |
| 160 |
}, |
| 161 |
titleColor: { |
| 162 |
type: 'string', |
| 163 |
default: '#528ffe', |
| 164 |
}, |
| 165 |
titleHoverColor: { |
| 166 |
type: 'string', |
| 167 |
}, |
| 168 |
countColor: { |
| 169 |
type: 'string', |
| 170 |
default: '#ffffff', |
| 171 |
}, |
| 172 |
countHoverColor: { |
| 173 |
type: 'string', |
| 174 |
default: '#ffffff', |
| 175 |
}, |
| 176 |
listIcon: { |
| 177 |
type: 'string', |
| 178 |
default: 'far fa-file-alt', |
| 179 |
}, |
| 180 |
listColor: { |
| 181 |
type: 'string', |
| 182 |
default: '#566e8b', |
| 183 |
}, |
| 184 |
listHoverColor: { |
| 185 |
type: 'string', |
| 186 |
}, |
| 187 |
iconColor: { |
| 188 |
type: 'string', |
| 189 |
}, |
| 190 |
showButtonIcon: { |
| 191 |
type: 'boolean', |
| 192 |
default: true, |
| 193 |
}, |
| 194 |
buttonIcon: { |
| 195 |
type: 'string', |
| 196 |
default: 'fas fa-angle-right', |
| 197 |
}, |
| 198 |
buttonIconPosition: { |
| 199 |
type: 'string', |
| 200 |
default: 'after', |
| 201 |
}, |
| 202 |
buttonColor: { |
| 203 |
type: 'string', |
| 204 |
default: '#528ffe', |
| 205 |
}, |
| 206 |
buttonHoverColor: { |
| 207 |
type: 'string', |
| 208 |
}, |
| 209 |
buttonPosition: { |
| 210 |
type: 'string', |
| 211 |
default: 'left', |
| 212 |
}, |
| 213 |
// typography attributes |
| 214 |
...generateTypographyAttributes(Object.values(typoPrefixs)), |
| 215 |
// responsive range |
| 216 |
...generateResponsiveRangeAttributes(COLUMNS, { |
| 217 |
defaultRange: 3, |
| 218 |
noUnits: true, |
| 219 |
}), |
| 220 |
...generateResponsiveRangeAttributes(GRID_SPACE, { |
| 221 |
defaultRange: 10, |
| 222 |
noUnits: true, |
| 223 |
}), |
| 224 |
...generateResponsiveRangeAttributes(COUNT_SIZE, { |
| 225 |
defaultRange: 30, |
| 226 |
}), |
| 227 |
...generateResponsiveRangeAttributes(ICON_SIZE, { |
| 228 |
defaultRange: 15, |
| 229 |
}), |
| 230 |
...generateResponsiveRangeAttributes(ICON_HEIGHT, { |
| 231 |
defaultRange: 15, |
| 232 |
}), |
| 233 |
...generateResponsiveRangeAttributes(ICON_WIDTH, { |
| 234 |
defaultRange: 15, |
| 235 |
}), |
| 236 |
// dimension |
| 237 |
...generateDimensionsAttributes(GRID_MARGIN), |
| 238 |
...generateDimensionsAttributes(GRID_PADDING), |
| 239 |
...generateDimensionsAttributes(TITLE_MARGIN), |
| 240 |
...generateDimensionsAttributes(TITLE_PADDING, { |
| 241 |
top: 0, |
| 242 |
right: 0, |
| 243 |
bottom: 20, |
| 244 |
left: 0, |
| 245 |
isLinked: false, |
| 246 |
}), |
| 247 |
...generateDimensionsAttributes(LIST_MARGIN), |
| 248 |
...generateDimensionsAttributes(LIST_PADDING), |
| 249 |
...generateDimensionsAttributes(ICON_MARGIN), |
| 250 |
...generateDimensionsAttributes(BTN_MARGIN), |
| 251 |
...generateDimensionsAttributes(BTN_PADDING), |
| 252 |
...generateDimensionsAttributes(WRAPPER_MARGIN, { |
| 253 |
top: 28, |
| 254 |
right: 0, |
| 255 |
bottom: 28, |
| 256 |
left: 0, |
| 257 |
isLinked: false, |
| 258 |
}), |
| 259 |
// background |
| 260 |
...generateBackgroundAttributes(GRID_BACKGROUND, { |
| 261 |
defaultFillColor: '#ffffff', |
| 262 |
noOverlay: true, |
| 263 |
}), |
| 264 |
...generateBackgroundAttributes(TITLE_BACKGROUND, { |
| 265 |
defaultFillColor: '#ffffff', |
| 266 |
noOverlay: true, |
| 267 |
noMainBgi: true, |
| 268 |
}), |
| 269 |
...generateBackgroundAttributes(COUNT_BACKGROUND, { |
| 270 |
defaultFillColor: '#528ffe', |
| 271 |
noOverlay: true, |
| 272 |
noMainBgi: true, |
| 273 |
}), |
| 274 |
...generateBackgroundAttributes(COUNT_BACKGROUND_LAYOUT_2, { |
| 275 |
defaultFillColor: '#fc8c91', |
| 276 |
noOverlay: true, |
| 277 |
noMainBgi: true, |
| 278 |
}), |
| 279 |
...generateBackgroundAttributes(LIST_BACKGROUND, { |
| 280 |
defaultFillColor: '#ffffff', |
| 281 |
noOverlay: true, |
| 282 |
noMainBgi: true, |
| 283 |
}), |
| 284 |
...generateBackgroundAttributes(BTN_BACKGROUND, { |
| 285 |
defaultFillColor: '#ffffff', |
| 286 |
noOverlay: true, |
| 287 |
noMainBgi: true, |
| 288 |
}), |
| 289 |
// border shadow attriubtes |
| 290 |
...generateBorderShadowAttributes(GRID_BORDER), |
| 291 |
...generateBorderShadowAttributes(TITLE_BORDER, { |
| 292 |
noShadow: true, |
| 293 |
bdrDefaults: { |
| 294 |
top: 0, |
| 295 |
right: 0, |
| 296 |
bottom: 2, |
| 297 |
left: 0, |
| 298 |
isLinked: false, |
| 299 |
}, |
| 300 |
defaultBdrColor: '#528ffe', |
| 301 |
defaultBdrStyle: 'solid', |
| 302 |
}), |
| 303 |
...generateBorderShadowAttributes(COUNT_BORDER, { noShadow: true }), |
| 304 |
...generateBorderShadowAttributes(BTN_BORDER, { noShadow: true }), |
| 305 |
categoryTitleLink:{ |
| 306 |
type: 'boolean', |
| 307 |
default: false, |
| 308 |
}, |
| 309 |
...generateDimensionsAttributes(CONTAINER_SECTION_MARGIN), |
| 310 |
...generateDimensionsAttributes(CONTAINER_SECTION_PADDING), |
| 311 |
...generateBackgroundAttributes(CONTAINER_SECTION_BACKGROUND, { |
| 312 |
defaultFillColor: 'rgba(255, 255, 255, 0)', |
| 313 |
noOverlay: true, |
| 314 |
}), |
| 315 |
prefix: { |
| 316 |
type: 'string', |
| 317 |
default: '', |
| 318 |
}, |
| 319 |
suffix: { |
| 320 |
type: 'string', |
| 321 |
default: '', |
| 322 |
}, |
| 323 |
suffixSingular: { |
| 324 |
type: 'string', |
| 325 |
default:'' |
| 326 |
}, |
| 327 |
tickerBackgroundColor:{ |
| 328 |
type:'string', |
| 329 |
default: 'rgb(173, 94, 98)' |
| 330 |
}, |
| 331 |
...generateDimensionsAttributes(COUNT_PADDING_LAYOUT_2), |
| 332 |
...generateDimensionsAttributes(COUNT_MARGIN_LAYOUT_2), |
| 333 |
...generateDimensionsAttributes(TITLE_PADDING_LAYOUT_2), |
| 334 |
...generateDimensionsAttributes(TITLE_MARGIN_LAYOUT_2) |
| 335 |
} |
| 336 |
|
| 337 |
export default attributes |
| 338 |
|