Skip to content

Commit

Permalink
Add more products
Browse files Browse the repository at this point in the history
  • Loading branch information
yeegor committed Apr 22, 2021
1 parent 3c250a5 commit 170d08b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 15 deletions.
77 changes: 63 additions & 14 deletions src/data/index.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
import Product from "./model/product";
import { Category } from "./type";

import { xboxDescription } from './items/descriptions';
import { xboxDescription, airpodsDescription, airtagDescription } from './items/descriptions';
import AttributeSet from "./model/attribute-set";
import Attribute from "./model/attribute";

const shoeSizes = new AttributeSet('Size')
.addItem(new Attribute('40'))
.addItem(new Attribute('41'))
.addItem(new Attribute('42'))
.addItem(new Attribute('43'));
.addItemList([
new Attribute('40'),
new Attribute('41'),
new Attribute('42'),
new Attribute('43')
]);


const clothesSizes = new AttributeSet('Size')
.addItem(new Attribute('Small', 'S'))
.addItem(new Attribute('Medium', 'M'))
.addItem(new Attribute('Large', 'L'))
.addItem(new Attribute('Extra Large', 'XL'));
.addItemList([
new Attribute('Small', 'S'),
new Attribute('Medium', 'M'),
new Attribute('Large', 'L'),
new Attribute('Extra Large', 'XL')
]);

const colors = new AttributeSet('Color')
.addItem(new Attribute('Green', '#44FF03'))
.addItem(new Attribute('Cyan', '#03FFF7'))
.addItem(new Attribute('Blue', '#030BFF'))
.addItem(new Attribute('Black', '#000000'))
.addItem(new Attribute('White', '#FFFFFF'));
.addItemList([
new Attribute('Green', '#44FF03'),
new Attribute('Cyan', '#03FFF7'),
new Attribute('Blue', '#030BFF'),
new Attribute('Black', '#000000'),
new Attribute('White', '#FFFFFF')
]);

const yesNo = [new Attribute('Yes'), new Attribute('No')];

const capacity = new AttributeSet('Capacity')
.addItem(new Attribute('512G'))
Expand Down Expand Up @@ -82,6 +91,46 @@ const products: Product[] = [
.addAttributeSet(colors)
.addAttributeSet(capacity)
.setDescription(xboxDescription)
.setCategory(Category.tech),

new Product('iMac 2021')
.setPrice(1400)
.addImages([
'https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/imac-24-blue-selection-hero-202104?wid=904&hei=840&fmt=jpeg&qlt=80&.v=1617492405000'
])
.addAttributeSet(new AttributeSet('Capacity')
.addItem(new Attribute('256GB'))
.addItem(new Attribute('512GB'))
)
.setDescription('The new iMac!')
.addAttributeSet(new AttributeSet('With USB 3 ports').addItemList(yesNo))
.addAttributeSet(new AttributeSet('Touch ID in keyboard').addItemList(yesNo))
.setCategory(Category.tech),

new Product('iPhone 12 Pro')
.setPrice(830)
.setDescription('This is iPhone 12. Nothing else to say.')
.addImages([
'https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/iphone-12-pro-family-hero?wid=940&hei=1112&fmt=jpeg&qlt=80&.v=1604021663000'
])
.addAttributeSet(capacity)
.addAttributeSet(colors)
.setCategory(Category.tech),

new Product('AirPods Pro')
.setPrice(249)
.addImages([
'https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/MWP22?wid=572&hei=572&fmt=jpeg&qlt=95&.v=1591634795000'
])
.setDescription(airpodsDescription)
.setCategory(Category.tech),

new Product('AirTag')
.setPrice(100)
.addImages([
'https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/airtag-double-select-202104?wid=445&hei=370&fmt=jpeg&qlt=95&.v=1617761672000'
])
.setDescription(airtagDescription)
.setCategory(Category.tech)
];

Expand Down
27 changes: 26 additions & 1 deletion src/data/items/descriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,29 @@ const xboxDescription = `
</ul>
</div>`;

export { xboxDescription };
const airpodsDescription = `
<h3>Magic like you’ve never heard</h3>
<p>AirPods Pro have been designed to deliver Active Noise Cancellation for immersive sound, Transparency mode so you can hear your surroundings, and a customizable fit for all-day comfort. Just like AirPods, AirPods Pro connect magically to your iPhone or Apple Watch. And they’re ready to use right out of the case.
<h3>Active Noise Cancellation</h3>
<p>Incredibly light noise-cancelling headphones, AirPods Pro block out your environment so you can focus on what you’re listening to. AirPods Pro use two microphones, an outward-facing microphone and an inward-facing microphone, to create superior noise cancellation. By continuously adapting to the geometry of your ear and the fit of the ear tips, Active Noise Cancellation silences the world to keep you fully tuned in to your music, podcasts, and calls.
<h3>Transparency mode</h3>
<p>Switch to Transparency mode and AirPods Pro let the outside sound in, allowing you to hear and connect to your surroundings. Outward- and inward-facing microphones enable AirPods Pro to undo the sound-isolating effect of the silicone tips so things sound and feel natural, like when you’re talking to people around you.</p>
<h3>All-new design</h3>
<p>AirPods Pro offer a more customizable fit with three sizes of flexible silicone tips to choose from. With an internal taper, they conform to the shape of your ear, securing your AirPods Pro in place and creating an exceptional seal for superior noise cancellation.</p>
<h3>Amazing audio quality</h3>
<p>A custom-built high-excursion, low-distortion driver delivers powerful bass. A superefficient high dynamic range amplifier produces pure, incredibly clear sound while also extending battery life. And Adaptive EQ automatically tunes music to suit the shape of your ear for a rich, consistent listening experience.</p>
<h3>Even more magical</h3>
<p>The Apple-designed H1 chip delivers incredibly low audio latency. A force sensor on the stem makes it easy to control music and calls and switch between Active Noise Cancellation and Transparency mode. Announce Messages with Siri gives you the option to have Siri read your messages through your AirPods. And with Audio Sharing, you and a friend can share the same audio stream on two sets of AirPods — so you can play a game, watch a movie, or listen to a song together.</p>
`

const airtagDescription = `
<h1>Lose your knack for losing things.</h1>
<p>AirTag is an easy way to keep track of your stuff. Attach one to your keys, slip another one in your backpack. And just like that, they’re on your radar in the Find My app. AirTag has your back.</p>
`

export { xboxDescription, airpodsDescription, airtagDescription };
6 changes: 6 additions & 0 deletions src/data/model/attribute-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class AttributeSet {

return this;
}

addItemList(items: Attribute[]) {
this.items.push(...items);

return this;
}
}

export default AttributeSet;

0 comments on commit 170d08b

Please sign in to comment.