@@ -4,6 +4,7 @@ import { iconRemixArrowRightSLine as iconChevron } from '../../assets/cc-remix.i
44import { fakeString } from '../../lib/fake-strings.js' ;
55import { skeletonStyles } from '../../styles/skeleton.js' ;
66import { i18n } from '../../translations/translation.js' ;
7+ import '../cc-block/cc-block.js' ;
78import '../cc-icon/cc-icon.js' ;
89import '../cc-notice/cc-notice.js' ;
910
@@ -22,17 +23,13 @@ const SKELETON_PROJECTS = new Array(5).fill({ name: fakeString(10), description:
2223export class CcHomepageTemplateProject extends LitElement {
2324 static get properties ( ) {
2425 return {
25- adaptHeight : { type : Boolean , attribute : 'adapt-height' , reflect : true } ,
2626 state : { type : Object } ,
2727 } ;
2828 }
2929
3030 constructor ( ) {
3131 super ( ) ;
3232
33- /** @type {boolean } Enables adaptive height mode: rows adjust their spacing to fill available height */
34- this . adaptHeight = false ;
35-
3633 /** @type {HomepageTemplateProjectState } Sets the state of the component */
3734 this . state = { type : 'loading' } ;
3835 }
@@ -42,19 +39,22 @@ export class CcHomepageTemplateProject extends LitElement {
4239 const projects = this . state . type === 'loaded' ? this . state . projects : SKELETON_PROJECTS ;
4340
4441 return html `
45- <div class = "wrapper" >
46- <div class = " title"> ${ i18n ( 'cc-homepage-template-project.title' ) } </ div>
42+ <cc - block >
43+ <div slot = "header- title"> ${ i18n ( 'cc-homepage-template-project.title' ) } </ div>
4744 ${ this . state . type === 'error'
48- ? html ` <cc- not ice intent= "warning" message = "${ i18n ( 'cc-homepage-template-project.error' ) } " > </ cc- not ice> `
49- : '' }
50- ${ this . state . type !== 'error'
5145 ? html `
52- <ul class= "project-list ${ classMap ( { skeleton } ) } " >
46+ <cc- not ice
47+ slot= "content"
48+ intent = "warning"
49+ message = "${ i18n ( 'cc-homepage-template-project.error' ) } "
50+ > </ cc- not ice>
51+ `
52+ : html `
53+ <ul slot= "content" class = "project-list ${ classMap ( { skeleton } ) } " >
5354 ${ projects . map ( ( project ) => this . _renderProjectRow ( project ) ) }
5455 </ ul>
55- `
56- : '' }
57- </ div>
56+ ` }
57+ </ cc- block>
5858 ` ;
5959 }
6060
@@ -85,33 +85,16 @@ export class CcHomepageTemplateProject extends LitElement {
8585 display : block;
8686 }
8787
88- .wrapper {
89- border : solid 1px var (--cc-color-border-neutral-weak , # e7e7e7 );
90- border-radius : var (--cc-border-radius-default , 0.25em );
91- box-sizing : border-box;
92- display : flex;
93- flex-direction : column;
94- gap : 1.25em ;
95- height : 100% ;
96- padding : 2em 1.25em ;
97- }
98-
99- .title {
100- color : var (--cc-color-text-primary-strongest , # 000 );
101- font-size : 1.2em ;
102- font-weight : bold;
103- margin : 0 0.75em ;
88+ cc-block {
89+ padding : 1em ;
10490 }
10591
10692 .project-list {
10793 display : flex;
108- flex : 1 ;
10994 flex-direction : column;
11095 gap : 0.3em ;
11196 list-style : none;
11297 margin : 0 ;
113- min-height : 0 ;
114- overflow : auto;
11598 padding : 0 ;
11699 }
117100
@@ -120,30 +103,11 @@ export class CcHomepageTemplateProject extends LitElement {
120103 border-radius : var (--cc-border-radius-default , 0.25em );
121104 display : flex;
122105 gap : 1em ;
106+ margin-inline : 0.2em ;
123107 padding : 0.6em 0.8em ;
124108 text-decoration : none;
125109 }
126110
127- /* Adaptive height mode */
128-
129- : host ([adapt-height ]) .wrapper {
130- container-type : size;
131- }
132-
133- : host ([adapt-height ]) .project-list {
134- gap : 0 ;
135- }
136-
137- : host ([adapt-height ]) .project-list li {
138- display : flex;
139- flex : 1 ;
140- }
141-
142- : host ([adapt-height ]) .project-row {
143- flex : 1 ;
144- padding-block : clamp (0.2em , 2cqh , 0.6em );
145- }
146-
147111 .project-row : hover {
148112 background : linear-gradient (90deg , rgb (56 49 241 / 20% ) 0% , rgb (135 46 237 / 20% ) 100% );
149113 }
0 commit comments