Skip to content

Commit c9af41b

Browse files
committed
Table size and companies array
1 parent efcc4f8 commit c9af41b

File tree

4 files changed

+72
-50
lines changed

4 files changed

+72
-50
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ <h1>Company Directory</h1>
2626
</div>
2727
</main>
2828

29-
<script src="scripts/script.js"></script>
29+
<script type="module" src="scripts/script.js"></script>
3030
</body>
3131
</html>

scripts/data/companies.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Array of companies
2+
const companies = [
3+
{
4+
name: "TechCorp",
5+
logo: "https://via.placeholder.com/100",
6+
url: "https://techcorp.com",
7+
tags: ["Tech", "Innovation"],
8+
},
9+
{
10+
name: "FinanceHub",
11+
logo: "https://via.placeholder.com/100",
12+
url: "https://financehub.com",
13+
tags: ["Finance", "Banking"],
14+
},
15+
{
16+
name: "RetailWorld",
17+
logo: "https://via.placeholder.com/100",
18+
url: "https://retailworld.com",
19+
tags: ["Retail", "E-commerce"],
20+
},
21+
{
22+
name: "RetailWorld",
23+
logo: "https://via.placeholder.com/100",
24+
url: "https://retailworld.com",
25+
tags: ["Retail", "E-commerce"],
26+
},
27+
{
28+
name: "RetailWorld",
29+
logo: "https://via.placeholder.com/100",
30+
url: "https://retailworld.com",
31+
tags: ["Retail", "E-commerce"],
32+
},
33+
{
34+
name: "RetailWorld",
35+
logo: "https://via.placeholder.com/100",
36+
url: "https://retailworld.com",
37+
tags: ["Retail", "E-commerce"],
38+
},
39+
{
40+
name: "RetailWorld",
41+
logo: "https://via.placeholder.com/100",
42+
url: "https://retailworld.com",
43+
tags: ["Retail", "E-commerce"],
44+
},
45+
{
46+
name: "RetailWorld",
47+
logo: "https://via.placeholder.com/100",
48+
url: "https://retailworld.com",
49+
tags: ["Retail", "E-commerce"],
50+
},
51+
{
52+
name: "RetailWorld",
53+
logo: "https://via.placeholder.com/100",
54+
url: "https://retailworld.com",
55+
tags: ["Retail", "E-commerce"],
56+
},
57+
{
58+
name: "RetailWorld",
59+
logo: "https://via.placeholder.com/100",
60+
url: "https://retailworld.com",
61+
tags: ["Retail", "E-commerce"],
62+
},
63+
];
64+
65+
export default companies;

scripts/script.js

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,4 @@
1-
// Array of companies
2-
const companies = [
3-
{
4-
name: "TechCorp",
5-
logo: "https://via.placeholder.com/100",
6-
url: "https://techcorp.com",
7-
tags: ["Tech", "Innovation"],
8-
},
9-
{
10-
name: "FinanceHub",
11-
logo: "https://via.placeholder.com/100",
12-
url: "https://financehub.com",
13-
tags: ["Finance", "Banking"],
14-
},
15-
{
16-
name: "RetailWorld",
17-
logo: "https://via.placeholder.com/100",
18-
url: "https://retailworld.com",
19-
tags: ["Retail", "E-commerce"],
20-
},
21-
{
22-
name: "RetailWorld",
23-
logo: "https://via.placeholder.com/100",
24-
url: "https://retailworld.com",
25-
tags: ["Retail", "E-commerce"],
26-
},
27-
{
28-
name: "RetailWorld",
29-
logo: "https://via.placeholder.com/100",
30-
url: "https://retailworld.com",
31-
tags: ["Retail", "E-commerce"],
32-
},
33-
{
34-
name: "RetailWorld",
35-
logo: "https://via.placeholder.com/100",
36-
url: "https://retailworld.com",
37-
tags: ["Retail", "E-commerce"],
38-
},
39-
{
40-
name: "RetailWorld",
41-
logo: "https://via.placeholder.com/100",
42-
url: "https://retailworld.com",
43-
tags: ["Retail", "E-commerce"],
44-
},
45-
];
1+
import companies from "./data/companies";
462

473
// Function to create cards
484
function createCompanyCards(companies) {
@@ -51,7 +7,7 @@ function createCompanyCards(companies) {
517
companies.forEach((company) => {
528
// Create column wrapper
539
const col = document.createElement("div");
54-
col.className = "col-lg-4"; // Flex column for 3-per-row layout
10+
col.className = "col-lg-3"; // Flex column for 3-per-row layout
5511

5612
// Create card container
5713
const card = document.createElement("div");

styles/styles.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
}
1515

1616
/* Column behavior (e.g., col-lg-4) */
17-
.col-lg-4 {
18-
flex: 0 0 33.333%; /* 3 columns per row */
19-
max-width: 33.333%; /* Ensure max-width is the same */
17+
.col-lg-3 {
18+
flex: 0 0 25%; /* 4 columns per row */
19+
max-width: 25%; /* Ensure max-width is the same */
2020
padding-left: 15px;
2121
padding-right: 15px;
2222
box-sizing: border-box; /* Include padding in the box size */
@@ -33,6 +33,7 @@
3333
border: 1px solid #ddd;
3434
border-radius: 10px;
3535
padding: 20px;
36+
margin: 15px;
3637
text-align: center;
3738
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
3839
transition: transform 0.2s ease, box-shadow 0.2s ease;

0 commit comments

Comments
 (0)