<!DOCTYPE html><html><head><title>CardOverview</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /></head><body><divid="root"><divclass="container sample"style="align-items: center;"><divclass="card-wrapper"><igc-card><igc-card-media><imgsrc="https://images.unsplash.com/photo-1518235506717-e1ed3306a89b?ixlib=rb-1.2.1&auto=format&fit=crop&w=640&q=50"></igc-card-media><igc-card-header><h3slot="title">New York City</h3><h5slot="subtitle">City in New York</h5></igc-card-header><igc-card-content><p>New York City comprises 5 boroughs sitting where the
Hudson River meets the Atlantic Ocean. At its core is Manhattan,
a densely populated borough that’s among the world’s major commercial,
financial and cultural centers.</p></igc-card-content><igc-card-actions><igc-buttonslot="start"><igc-ripple></igc-ripple>
Read more
</igc-button><divslot="end"><igc-icon-buttonname="twitter"style="margin-right: 10px;"><igc-ripple></igc-ripple></igc-icon-button><igc-icon-buttonname="facebook"><igc-ripple></igc-ripple></igc-icon-button></div></igc-card-actions></igc-card></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
Ignite UI for Web Components에 대한 전체 소개를 보려면 시작하기 항목을 읽어보세요.
그런 다음 데모 카드 템플릿을 나타내기 위해 다음 코드를 추가할 수 있습니다.
<igc-card><igc-card-media><imgsrc="https://images.unsplash.com/photo-1518235506717-e1ed3306a89b?ixlib=rb-1.2.1&auto=format&fit=crop&w=640&q=50"></igc-card-media><igc-card-header><h3slot="title">New York</h3><h5slot="subtitle">City in New York</h5></igc-card-header><igc-card-content><p>New York City comprises 5 boroughs sitting where the Hudson River meets the Atlantic Ocean. At its core is Manhattan, a densely populated borough that’s among the world’s major commercial, financial and cultural centers.</p></igc-card-content><igc-card-actions><igc-buttonslot="start"><igc-ripple></igc-ripple>
Read more
</igc-button><divslot="end"><igc-icon-buttonname="twitter"style="margin-right: 10px;"><igc-ripple></igc-ripple></igc-icon-button><igc-icon-buttonname="facebook"><igc-ripple></igc-ripple></igc-icon-button></div></igc-card-actions></igc-card>html
위에서 몇 가지 사항을 확인할 수 있습니다. 첫째, 우리가 원할 때 꼬리표 헤더 제목과 같은 요소 h3 제목 사이에 배치합니다. IgcCardHeaderComponent 태그를 지정하고 슬롯 이름을 다음으로 설정합니다. title. 반대로, 다른 제목 요소를 subtitle 슬롯 이름을 지정하겠습니다. subtitle.
카드에 표시하려는 이미지나 비디오는 IgcCardMediaComponent 태그 안에 포함됩니다. IgcCardMediaComponent를 사용하면 요소의 전체 콘텐츠 상자를 채우는 동안 가로 세로 비율을 유지하도록 내부에 배치된 콘텐츠의 크기를 조정할 수 있습니다. 개체의 가로 세로 비율이 상자의 가로 세로 비율과 일치하지 않으면 개체가 맞게 잘립니다.
카드에는 설정된 경우 카드에서 그림자를 제거하고 얇은 테두리로 대체하여 카드를 배경과 분리하는 outlined 속성이 있습니다.
Horizontal Layout
기본적으로 카드의 모든 섹션(헤더, 콘텐츠, 미디어, 작업)은 수직으로 배치됩니다. 수직 공간이 많을 때 좋습니다. 카드의 섹션을 수평으로 배치하고 싶다고 가정해 보겠습니다. 간단한 CSS를 사용하여 이러한 레이아웃을 구현할 수 있습니다.
다음은 윤곽선이 있는 가로 카드의 예입니다.
<igc-cardoutlined><divclass="card-horizontal"><div><igc-card-header><imgsrc="ROZES-Under-the-Grave.jpg"slot="thumbnail"><h5slot="title">Rozes</h5><h5slot="subtitle">Under the Grave (2016)</h5></igc-card-header><igc-card-content><p>As I have always said: I write what’s real and what’s true,
even if it means throwing myself under the bus.</p></igc-card-content></div><divclass="divider"></div><igc-card-actions><igc-icon-buttonname="previous"></igc-icon-button><igc-icon-buttonname="play"></igc-icon-button><igc-icon-buttonname="next"></igc-icon-button></igc-card-actions></div></igc-card>html
<!DOCTYPE html><html><head><title>Horizontal Card Layout</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons"><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /></head><body><divid="root"><divclass="container sample"style="align-items: center;"><divclass="card-wrapper"><igc-card><divclass="card-horizontal"><div><igc-card-header><imgsrc="https://static.infragistics.com/xplatform/images/music/rozes.jpg"slot="thumbnail"><h5slot="title">Rozes</h5><h5slot="subtitle">Under the Grave (2016)</h5></igc-card-header><igc-card-content><p>As I have always said: I write what’s real and what’s true,
even if it means throwing myself under the bus.</p></igc-card-content></div><divclass="divider"></div><igc-card-actions><spanclass="material-icons">skip_previous</span><spanclass="material-icons">play_arrow</span><spanclass="material-icons">skip_next</span></igc-card-actions></div></igc-card></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
다음은 카드의 모든 섹션이 수직으로 배치되고 IgcCardMediaComponent 수직 섹션 옆에 나타나는 반수평 카드를 만드는 방법을 보여주는 예입니다.
<igc-card><divclass="semi-horizontal"><div><igc-card-header><igc-avatarsrc="mellow_d.jpg"slot="thumbnail">MD</igc-avatar><h5slot="title">HERE</h5><h5slot="subtitle">by Mellow D</h5></igc-card-header><igc-card-content><p>Far far away, behind the word mountains,
far from the countries Vokalia and Consonantia,
there live the blind texts.</p></igc-card-content><igc-card-actions><igc-button>play album</igc-button></igc-card-actions></div><igc-card-mediaclass="card-media"><imgsrc="here_media.jpg"></igc-card-media></div></igc-card>html
<!DOCTYPE html><html><head><title>Card Semi-horizontal Layout</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /></head><body><divid="root"><divclass="container sample"style="align-items: center;"><divclass="card-wrapper"><igc-card><divclass="semi-horizontal"><div><igc-card-header><igc-avatarsrc="https://static.infragistics.com/xplatform/images/music/singer_with_mic.jpg"slot="thumbnail">MD</igc-avatar><h5slot="title">HERE</h5><h5slot="subtitle">by Mellow D</h5></igc-card-header><igc-card-content><p>Far far away, behind the word mountains,
far from the countries Vokalia and Consonantia,
there live the blind texts.</p></igc-card-content><igc-card-actions><igc-button>play album</igc-button></igc-card-actions></div><igc-card-mediaclass="card-media"><imgsrc="https://static.infragistics.com/xplatform/images/music/singer_female.jpg"></igc-card-media></div></igc-card></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
<igc-card-actions><igc-buttonslot="end"><igc-ripple></igc-ripple>
Read more
</igc-button><divslot="start"><igc-icon-buttonname="twitter"><igc-ripple></igc-ripple></igc-icon-button><igc-icon-buttonname="facebook"><igc-ripple></igc-ripple></igc-icon-button></div></igc-card-actions>html
이제 아이콘 버튼이 텍스트 버튼 앞에 나타납니다.
간단히 슬롯 속성을 생략하고 요소가 기본 슬롯으로 이동하도록 하여 그 사이에 더 많은 콘텐츠를 추가할 수도 있습니다.
<!DOCTYPE html><html><head><title>Card Styling</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css"type="text/css" /></head><body><divid="root"><divclass="container sample"style="align-items: center;"><divclass="card-wrapper"><igc-card><igc-card-mediaheight="180px"><imgsrc="https://images.unsplash.com/photo-1541516160071-4bb0c5af65ba?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80"></igc-card-media><igc-card-header><h3slot="title">Jane Doe</h3><h5slot="subtitle">Professional Photographer</h5></igc-card-header><igc-card-content><p>Hi! I'm Jane, photographer and filmmaker.
Photography is a way of feeling, of touching,
of loving. What you have caught on film is captured forever...
it remembers little things, long after you have
forgotten everything.</p></igc-card-content><igc-card-actions><divslot="end"><igc-icon-buttonname="twitter"><igc-ripple></igc-ripple></igc-icon-button><igc-icon-buttonname="facebook"><igc-ripple></igc-ripple></igc-icon-button><igc-icon-buttonname="instagram"><igc-ripple></igc-ripple></igc-icon-button></div></igc-card-actions></igc-card></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
Summary
이 기사에서는 카드 구성 요소에 대해 많은 부분을 다루었습니다. 간단한 카드를 만들고 몇 가지 이미지를 추가하여 좀 더 매력적으로 만들었습니다. 카드 내부에 아바타, 버튼, 아이콘과 같은 추가 Web Components 사용하여 경험을 풍부하게 하고 몇 가지 기능을 추가했습니다. 마지막으로 빌딩 블록의 주요 색상을 변경하여 카드의 모양을 변경했습니다.