Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 420db90

Browse files
author
X Li
authored
Merge pull request #243 from Ultimaker/CS-256_replace_logobot
Component updates for replacing the logobot
2 parents 3a1f00c + 2fe83d4 commit 420db90

File tree

9 files changed

+101
-1
lines changed

9 files changed

+101
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`The BoxPlaceholder component should render 1`] = `
4+
<div
5+
className="box-placeholder"
6+
style={
7+
Object {
8+
"height": "10rem",
9+
"width": "10rem",
10+
}
11+
}
12+
>
13+
<Icon(BoxIcon) />
14+
</div>
15+
`;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2018 Ultimaker B.V.
2+
import * as React from 'react';
3+
import { shallow } from 'enzyme';
4+
5+
// component
6+
import BoxPlaceholder from '../box_placeholder';
7+
8+
describe('The BoxPlaceholder component', () => {
9+
let props;
10+
let wrapper;
11+
12+
beforeEach(() => {
13+
props = {
14+
size: '10rem',
15+
};
16+
wrapper = shallow(<BoxPlaceholder {...props} />);
17+
});
18+
19+
it('should render', () => {
20+
expect(wrapper).toMatchSnapshot();
21+
});
22+
});

src/components/box_placeholder.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as React from 'react';
2+
3+
import BoxIcon from './icons/box_icon';
4+
5+
export interface BoxPlaceholderProps {
6+
/** Size of the placeholder. Include unit */
7+
size: string;
8+
}
9+
10+
11+
export const BoxPlaceholder: React.StatelessComponent<BoxPlaceholderProps> = ({ size }) => (
12+
<div
13+
className="box-placeholder"
14+
style={{ height: size, width: size }}
15+
>
16+
<BoxIcon />
17+
</div>
18+
);
19+
20+
BoxPlaceholder.displayName = 'BoxPlaceholder';
21+
22+
export default BoxPlaceholder;

src/components/icons/box_icon.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as React from 'react';
2+
import { IconWrapper, IconProps } from './icon_wrapper';
3+
4+
const BoxIcon: React.StatelessComponent<IconProps> = ({ className }): JSX.Element => (
5+
<div className={`${className} icon--box`}>
6+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
7+
<path d="M22,6.9c0-0.1,0-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1-0.1-0.2-0.2-0.2c0,0,0,0,0-0.1c-0.1-0.1-0.2-0.1-0.3-0.2l-9-4c-0.3-0.1-0.6-0.1-0.8,0l-9,4c-0.1,0-0.2,0.1-0.3,0.2c0,0,0,0,0,0.1C2.2,6.4,2.2,6.5,2.1,6.5c0,0,0,0,0,0c0,0,0,0,0,0C2,6.7,2,6.8,2,6.9c0,0,0,0,0,0c0,0,0,0,0,0v10c0,0.4,0.2,0.8,0.6,0.9l9,4c0,0,0,0,0,0C11.7,22,11.9,22,12,22s0.3,0,0.4-0.1c0,0,0,0,0,0l9-4c0.4-0.2,0.6-0.5,0.6-0.9L22,6.9C22,7,22,7,22,6.9C22,7,22,7,22,6.9z M12,4.1L18.5,7L12,9.9L5.5,7L12,4.1z M4,8.5l7,3.1v7.8l-7-3.1V8.5z M13,19.5v-7.8l7-3.1v7.8L13,19.5z"/>
8+
</svg>
9+
</div>
10+
);
11+
12+
BoxIcon.displayName = 'BoxIcon';
13+
14+
export default IconWrapper(BoxIcon);

src/components/image.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ export interface ImageProps {
1717
className?: string;
1818
/** image alt */
1919
alt?: string;
20+
/** image title */
21+
title?: string;
2022
}
2123

2224
export const Image: React.StatelessComponent<ImageProps> = ({
23-
shape, src, size, id, className, alt,
25+
shape, src, size, id, className, alt, title,
2426
}) => {
2527
const classes = classNames(`image image--${shape}`, className);
2628
return (
2729
<img
2830
id={id}
2931
src={src}
3032
alt={alt}
33+
title={title}
3134
className={classes}
3235
style={{ width: size, height: size }}
3336
/>

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export * from './components/app_switcher_menu';
77
export * from './components/app_switcher_trigger';
88
export * from './components/aspect_ratio_container';
99
export * from './components/beta_pill';
10+
export * from './components/box_placeholder';
1011
export * from './components/button';
1112
export * from './components/carousel';
1213
export * from './components/checkbox';
@@ -99,6 +100,7 @@ export * from './components/input_fields/textarea_field';
99100
export * from './components/icons/icon_wrapper';
100101
export { default as ApprovedIcon } from './components/icons/approved_icon';
101102
export { default as BuildPlateIcon } from './components/icons/build_plate_icon';
103+
export { default as BoxIcon } from './components/icons/box_icon';
102104
export { default as CameraIcon } from './components/icons/camera_icon';
103105
export { default as CrossIcon } from './components/icons/cross_icon';
104106
export { default as CuraLogo } from './components/icons/cura_logo';

src/stories/icons.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GridItem from '../components/grid_item';
1414
import Tooltip from '../components/tooltip';
1515
import CrossIcon from '../components/icons/cross_icon';
1616
import ApprovedIcon from '../components/icons/approved_icon';
17+
import BoxIcon from '../components/icons/box_icon';
1718
import EmailIcon from '../components/icons/email_icon';
1819
import HighlightIcon from '../components/icons/highlight_icon';
1920
import PasswordIcon from '../components/icons/password_icon';
@@ -98,6 +99,11 @@ stories.add('Icons', withInfo(
9899
<ApprovedIcon {...props} />
99100
</Tooltip>
100101
</GridItem>
102+
<GridItem layoutWidth="fit">
103+
<Tooltip tooltipText="BoxIcon">
104+
<BoxIcon {...props} />
105+
</Tooltip>
106+
</GridItem>
101107
<GridItem layoutWidth="fit">
102108
<Tooltip tooltipText="PendingIcon">
103109
<PendingIcon {...props} />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.box-placeholder {
2+
background-color: $color-transparent-grey-light;
3+
display: flex;
4+
justify-content: center;
5+
align-items: center;
6+
7+
.icon--box {
8+
width: 50%;
9+
height: 50%;
10+
11+
svg {
12+
fill: $color-grey-mid;
13+
}
14+
}
15+
}

src/stylesheets/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@
6060
@import "app_switcher_menu";
6161
@import "sub_navigation_menu";
6262
@import "sub_navigation_mobile_menu";
63+
@import "box_placeholder";

0 commit comments

Comments
 (0)