Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <header>
	<div class="container-fluid mt-2 p-2 text-center">
		<div class="row">
			<div class="col">
				<h1 class="display-1 title">Emoji Zoo</h1>
			</div>
		</div>
	</div>
</header>

<main>
	<div id="app" class="container p-2 text-center">
		<div class="row mb-4">
			<div class="col">
				<button @click="generateAnimals" type="button" class="btn btn-secondary">Generate Animals!</button>
			</div>
		</div>
		<div class="container p-2 zoo">
			<div class="row align-items-center text-center">
				<div class="col">
					<emoji-component v-for="animal in zooGroupA" :emoji="animal"></emoji-component>
				</div>
				<div class="col">
					<emoji-component v-for="animal in zooGroupB" :emoji="animal"></emoji-component>
				</div>
				<div class="col">
					<emoji-component v-for="animal in zooGroupC" :emoji="animal"></emoji-component>
				</div>
				<div class="col">
					<emoji-component v-for="animal in zooGroupD" :emoji="animal"></emoji-component>
				</div>
			</div>
		</div>
	</div>
</main>

<footer>
	<div class="container-fluid p-4 text-center">
		<div class="row">
			<div class="col">
				<small>Coded with 💜 by Katerina Navab &copy2022</small>
			</div>
		</div>
	</div>
</footer>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap");

html {
	min-height: 100%;
}
body {
	width: 100%;
	background: linear-gradient(to top, rgb(9, 32, 63) 0%, rgb(83, 120, 149) 100%);
	font-family: "Fredoka One", cursive;
	color: white;
}
/* CSS Gradient Generator: https://angrytools.com/gradient/ */
.title {
	/* ff 3.6+ */
	background: -moz-linear-gradient(
		130deg,
		#ff79fa 26%,
		#28bcff 50%,
		#58ffb9 79%
	);
	/* safari 5.1+,chrome 10+ */
	background: -webkit-linear-gradient(
		130deg,
		#ff79fa 26%,
		#28bcff 50%,
		#58ffb9 79%
	);
	/* opera 11.10+ */
	background: -o-linear-gradient(130deg, #ff79fa 26%, #28bcff 50%, #58ffb9 79%);
	/* ie 6-9 */
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#58FFB9', endColorstr='#FF79FA', GradientType=0 );
	/* ie 10+ */
	background: -ms-linear-gradient(130deg, #ff79fa 26%, #28bcff 50%, #58ffb9 79%);
	/* global 94%+ browsers support */
	background: linear-gradient(130deg, #ff79fa 26%, #28bcff 50%, #58ffb9 79%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}
/* CSS Pattern Generator: https://www.magicpattern.design/tools/css-backgrounds */
.zoo {
	min-height: 50vh;
	border: 11px dotted #694d2c;
	background-color: #6f9340;
	opacity: 0.9;
	background: radial-gradient(
			circle,
			transparent 20%,
			#6f9340 20%,
			#6f9340 80%,
			transparent 80%,
			transparent
		),
		radial-gradient(
				circle,
				transparent 20%,
				#6f9340 20%,
				#6f9340 80%,
				transparent 80%,
				transparent
			)
			10px 10px,
		linear-gradient(#7ca448 0.8px, transparent 0.8px) 0 -0.4px,
		linear-gradient(90deg, #7ca448 0.8px, #6f9340 0.8px) -0.4px 0;
	background-size: 20px 20px, 20px 20px, 10px 10px, 10px 10px;
	box-shadow: 10px 10px 20px 12px rgba(0, 0, 0, 0.2);
}
.emoji {
	width: 100%;
	flex: 1;
	font-size: 4rem;
}

              
            
!

JS

              
                /* AUTHOR: Katerina Navab
 * Built with Vue v3.x.x
 */

/*
TODO: Implement feedback below

One tip I have. It's not wrong to have 4 arrays for each group. But a more sophisticated (and probably more conventional way) of doing this would be to have 1 array for your zoo (all animals) but within it have sub-arrays to group things.

zooGroups = [
  [],
  [],
  [],
  []
]

What this allows then, is for your TEMPLATE to process these as a more frictionless routine.

// refers to each item in zooGroups, an array of animals
<parent v-for="group in zooGroups">

  // sub-loop to go through each item in the group, an animal emoji
  <div v-for="animal in group">
    <div>{{ animal }}</div>
  </div>
</parent>

Thinking of groups? Always think the group is an array structure somehow. So then the question might be, how do I CREATE an array in arrays? This is where you can do some computation using... compute!

computed: {
  animalGroups() {
    return // somehow generate the array in array structure based on your criteria
  }
}

This type of thinking is the next step for you. How can you take advantage of the characteristics of arrays and objects to more efficiently build / structure you data which then translates into conceptual representations? Very cool stuff and I like where you're at.
*/

const App = Vue.createApp({
	data() {
		return {
			allAnimals: [
				"🐶",
				"🐱",
				"🐭",
				"🐹",
				"🐰",
				"🦊",
				"🐻",
				"🐼",
				"🐨",
				"🐯",
				"🦁",
				"🐮",
				"🐷",
				"🐸",
				"🐵",
				"🐒",
				"🐔",
				"🐧",
				"🐦",
				"🐤",
				"🐣",
				"🐥",
				"🦆",
				"🦅",
				"🦉",
				"🦇",
				"🐺",
				"🐗",
				"🐴",
				"🦄",
				"🐝",
				"🐛",
				"🦋",
				"🐌",
				"🐞",
				"🐜",
				"🕷",
				"🐢",
				"🐍",
				"🦎",
				"🦂",
				"🦀",
				"🦑",
				"🐙",
				"🦐",
				"🐠",
				"🐟",
				"🐡",
				"🐬",
				"🦈",
				"🐳",
				"🐋",
				"🐊",
				"🐆",
				"🐅",
				"🐃",
				"🐂",
				"🐄",
				"🦌",
				"🐪",
				"🐫",
				"🐘",
				"🦏",
				"🦍",
				"🐎",
				"🐖",
				"🐐",
				"🐏",
				"🐑",
				"🐕",
				"🐩",
				"🐈",
				"🐓",
				"🦃",
				"🕊",
				"🐇",
				"🐁",
				"🐀",
				"🐿",
				"🦓",
				"🦒",
				"🦔",
				"🦕",
				"🦖"
			],
			numAnimals: 4,
			zooGroupA: [],
			zooGroupB: [],
			zooGroupC: [],
			zooGroupD: []
		};
	},
	methods: {
		generateAnimals() {
			this.zooGroupA = [];
			this.zooGroupB = [];
			this.zooGroupC = [];
			this.zooGroupD = [];
			for (let i = 0; i < this.numAnimals; i++) {
				this.zooGroupA.push(
					this.allAnimals[Math.floor(Math.random() * this.allAnimals.length)]
				);
				this.zooGroupB.push(
					this.allAnimals[Math.floor(Math.random() * this.allAnimals.length)]
				);
				this.zooGroupC.push(
					this.allAnimals[Math.floor(Math.random() * this.allAnimals.length)]
				);
				this.zooGroupD.push(
					this.allAnimals[Math.floor(Math.random() * this.allAnimals.length)]
				);
			}
		}
	}
});

App.component("emoji-component", {
	props: ["emoji"],
	data() {
		return {};
	},
	template: '<div class="emoji">{{ this.emoji }}</div>'
});

App.mount("#app");

              
            
!
999px

Console