Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bc7e5e2
[WIP] adds card, cardHeader, cardContent, cardImage
Feb 6, 2024
8937781
adds cardActions, cardFooter & some refactoring
Feb 7, 2024
8343c36
[WIP] adds changes before rebase
Feb 7, 2024
f25feb7
[WIP] adds changes before rebase
Feb 7, 2024
f914b71
[wip] adds comments for proper use of prop children in every component
Feb 7, 2024
2ebc350
[wip] adds some fixes to unit tests
Feb 7, 2024
1b1a997
[wip] adds Card unit test refactoring
Feb 8, 2024
2b6e254
[wip] adds CardHeader unit test
Feb 8, 2024
98ebb2a
[wip] adds CardContent unit test
Feb 8, 2024
8875e16
[wip] fix CardHeader data-testid
Feb 8, 2024
5e95053
[wip] adds CardActions unit test
Feb 8, 2024
4d26533
[wip] adds default className props to all components
Feb 8, 2024
49c074b
adds CardFooter unit test
Feb 8, 2024
2764448
removes default classname prop
Feb 8, 2024
3d61a06
[wip] adds varian & layout props to card component
Feb 8, 2024
97ccc73
[wip] adds cardDemo horizontal variation
Feb 8, 2024
ebb60f6
refactoring CardDemo horizontal variation
Feb 9, 2024
bfff622
adds Vertical CardDemo example
Feb 9, 2024
d39f84c
adds social-like card demo
Feb 9, 2024
5219c9a
[wip] adds unstyled stories and relative documentation
Feb 12, 2024
3f52dac
[wip] adds Card component to preview.js
Feb 12, 2024
e7035f6
[wip] CARD: adds vertical-variation classBased stories + styling
Feb 12, 2024
1308447
[wip] CARD: adds ClassBased stories & styling
Feb 12, 2024
a1b76ad
[issue 550] adds live demo
Feb 12, 2024
3bc86b3
adds defaul to layout prop and autodocs tag
Feb 16, 2024
2ef1a49
[CARD] adds context to pass props needed by children & changes classn…
Feb 19, 2024
6ba2025
[CARD] adds interactive card example
Feb 19, 2024
35e02c2
adds classBased stories for interact variation
Feb 20, 2024
ee69d7a
feat: add some description
daniele-zurico Feb 20, 2024
0eb7de0
feat: add some description
daniele-zurico Feb 20, 2024
b84e8bc
fix: solved rest props fix and add interaction variant storie
jgonza16 Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export const parameters = {
['Documentation', 'Live', 'Without style', 'Class based'],
'Table',
['Documentation', 'Live', 'Without style', 'Class based'],
'Card',
['Documentation', 'Live', 'Without style', 'Class based'],
],
'Typography',
[
Expand Down
136 changes: 136 additions & 0 deletions example/src/components/CardDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import {
Card,
CardHeader,
CardContent,
CardActions,
CardImage,
Heading,
List,
TYPE_LIST,
Button,
BUTTON_TYPE,
ListItem,
Paragraph,
} from '@capgeminiuk/dcx-react-library';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faAngleRight } from '@fortawesome/free-solid-svg-icons';
import './cardDemo.scss';

export const CardDemo = () => {
return (
<div className="demo-cards-container">
<h1>Horizontal card example</h1>
<Card layout="horizontal">
<CardImage src="https://placehold.co/200" alt="card demo image" />
<div className="text-wrapper">
<CardHeader>
<Heading
className="card-heading-text"
level="h4"
label="Order ID"
/>
</CardHeader>
<CardContent>
<List type={TYPE_LIST.UNORDERED} className="card-content-list">
{lisItems.map((i) => (
<ListItem key={i.id}>{i.name}</ListItem>
))}
</List>
</CardContent>
<CardActions>
<Button type={BUTTON_TYPE.BUTTON}>
<FontAwesomeIcon icon={faAngleRight} />
</Button>
</CardActions>
</div>
</Card>
<h1>Vertical card example</h1>
<Card layout="vertical">
<CardImage src="https://placehold.co/200" alt="card demo image" />
<div className="text-wrapper">
<CardHeader>
<Heading className="heading-text" level="h4" label="Order ID" />
</CardHeader>
<CardContent>
<List type={TYPE_LIST.UNORDERED} className="content-list">
{lisItems.map((i) => (
<ListItem key={i.id}>{i.name}</ListItem>
))}
</List>
</CardContent>
<CardActions>
<Button type={BUTTON_TYPE.BUTTON}>
<FontAwesomeIcon icon={faAngleRight} />
</Button>
</CardActions>
</div>
</Card>
<h1>Vertical card example, social-like post</h1>
<Card layout="vertical" className="social-card-demo">
<CardHeader className="card-user-info">
<CardImage
className="card-user_image"
src="https://placehold.co/40"
alt="card demo image"
/>
<div className="card-user_heading">
<Heading level="h4" label="Shiba Inu" />
<Heading level="h6" label="Dog breed" />
</div>
</CardHeader>
<CardImage
className="post-image"
src="https://placehold.co/200x160"
alt="post image"
/>
<CardContent className="social-card_content">
<Paragraph>
Nullam sodales semper ipsum, et luctus lacus sodales in. Nulla nibh
nisl, egestas et elit et, interdum cursus massa. Morbi luctus
consequat felis, eget sagittis nisi vestibulum sed.
</Paragraph>
</CardContent>
<CardActions className="social-card_actions">
<Button type={BUTTON_TYPE.BUTTON} label="LIKE"></Button>
<Button type={BUTTON_TYPE.BUTTON} label="SHARE"></Button>
</CardActions>
</Card>
<h1>Interactive card variant</h1>
<Card variant="interact">
<CardHeader>
<Heading className="heading-text" level="h4" label="Article title" />
</CardHeader>
<CardImage src="https://placehold.co/200" alt="card demo image" />
<CardContent>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet quam
placeat in...
</p>
</CardContent>
</Card>
</div>
);
};

const lisItems = [
{
id: 1,
name: 'Customer Number',
},
{
id: 2,
name: 'Dates of Sales',
},
{
id: 3,
name: 'Department',
},
{
id: 4,
name: 'Sale Cost (£)',
},
{
id: 5,
name: 'Status',
},
];
177 changes: 177 additions & 0 deletions example/src/components/cardDemo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
.demo-cards-container {
display: flex;
flex-direction: column;
margin: 0 0 30px 30px;

h1:not(:first-child) {
margin-top: 100px;
}
}

.dcx-card-horizontal {
display: flex;
justify-content: space-between;
width: 550px;
max-height: 300px;
padding: 15px;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;

.text-wrapper {
flex-grow: 1;
display: flex;
flex-direction: column;

.dcx-card-horizontal {
.card-heading-text {
font-weight: 600;
}
}

.dcx-card-content-horizontal {
.card-content-list {
margin: 0;
padding: 0;
list-style: none;

li:not(:first-child) {
padding-top: 10px;
}
}
}
}

.dcx-card-image-horizontal {
max-width: 100%;
max-height: 100%;
margin-right: 50px;
}

.dcx-card-actions-horizontal {
align-self: flex-end;

button {
border: none;
background: none;
}
}
}

.dcx-card-vertical {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 300px;
max-height: 550px;
padding: 25px;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;

.text-wrapper {
flex-grow: 1;
display: flex;
flex-direction: column;
margin-top: 30px;

.dcx-card-header-vertical {
.heading-text {
font-weight: 600;
}
}

.dcx-card-content-vertical {
.content-list {
margin: 0;
padding: 0;
list-style: none;

li:not(:first-child) {
padding-top: 10px;
}
}
}
}

.dcx-card-image-vertical {
max-width: 100%;
max-height: 100%;
}

.dcx-card-actions-vertical {
align-self: flex-end;

button {
border: none;
background: none;
}
}
}

.social-card-demo {
width: 300px;
max-height: 550px;
padding: 15px 0;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;

&.dcx-card-vertical {
display: flex;
flex-direction: column;
justify-content: space-between;
}

.card-user-info {
padding: 0 15px;
display: flex;
align-items: center;

.card-user_heading {
margin-left: 20px;
flex-grow: 3;
h4 {
font-weight: 600;
margin: 0;
}
h6 {
margin-bottom: 0;
margin-top: 5px;
}
}

.card-user_image {
border-radius: 50%;
}
}

.post-image {
margin-top: 20px;
max-width: 100%;
max-height: 100%;
}

.social-card_content {
padding: 0 15px;
margin-top: 20px;
font-size: 12px;
}

.social-card_actions {
padding: 0 15px;
button {
border: none;
background: none;
font-weight: 600;
}
}
}

.dcx-card-interact {
&:hover {
box-shadow: rgba(0, 0, 255, 0.24) 0px 6px 12px;
}

.heading-text {
font-weight: 600;
}

.dcx-card-content {
margin-top: 15px;
}
}
1 change: 1 addition & 0 deletions example/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ export { BreadcrumbDemo } from './BreadcrumbDemo';
export { AccordionDemo } from './AccordionDemo';
export * from './library-candidates';
export { ButtonGroupDemo } from './ButtonGroupDemo';
export { CardDemo } from './CardDemo';
2 changes: 2 additions & 0 deletions example/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
ListDemo,
AccordionDemo,
ButtonGroupDemo,
CardDemo,
} from './components';
import './global-styles.scss';
import { Login } from './pages/Login';
Expand Down Expand Up @@ -74,6 +75,7 @@ const App = () => (
<Route path="/breadcrumb" element={<BreadcrumbDemo />} />
<Route path="/accordion" element={<AccordionDemo />} />
<Route path="/buttonGroup" element={<ButtonGroupDemo />} />
<Route path="/card" element={<CardDemo />} />
</Routes>
</BrowserRouter>
</div>
Expand Down
Loading