Skip to content

Commit 95d60e3

Browse files
committed
Search for icons
1 parent 0d07d3c commit 95d60e3

File tree

2 files changed

+307
-2
lines changed

2 files changed

+307
-2
lines changed

apps/components_guide/lib/components_guide/research/static.ex

Lines changed: 299 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,290 @@ defmodule ComponentsGuide.Research.Static do
5454
{"HTTP", ["rfc2616", "rfc7230", "rfc7231", "rfc7232", "rfc7233", "rfc7234", "rfc7235"], []},
5555
{"Timestamps", ["rfc3339", "ISO 8601"], []},
5656
{"WebSockets", ["rfc6455"], []},
57-
{"DNS-Based Service Discovery", ["rfc6763"], []},
57+
{"DNS-Based Service Discovery", ["rfc6763"], []}
5858
]
5959

60+
@icon_names [
61+
"acast",
62+
"access",
63+
"adobe",
64+
"airbnb",
65+
"amazon",
66+
"amazon_alexa",
67+
"amazon_s3",
68+
"amberframework",
69+
"andotp",
70+
"android",
71+
"angellist",
72+
"angular",
73+
"ansible",
74+
"apereo",
75+
"apple",
76+
"apple_music",
77+
"arch_linux",
78+
"auth0",
79+
"authy",
80+
"backbone",
81+
"badoo",
82+
"baidu",
83+
"bandcamp",
84+
"behance",
85+
"bing",
86+
"bitbucket",
87+
"bitcoin",
88+
"bitwarden",
89+
"blogger",
90+
"bluetooth",
91+
"buffer",
92+
"calendar",
93+
"centos",
94+
"chrome",
95+
"chromium",
96+
"clojure",
97+
"cloudflare",
98+
"codeberg",
99+
"codepen",
100+
"coffeescript",
101+
"coil",
102+
"coinpot",
103+
"crystal",
104+
"debian",
105+
"deezer",
106+
"delicious",
107+
"dev_to",
108+
"digidentity",
109+
"digitalocean",
110+
"discord",
111+
"disqus",
112+
"djangoproject",
113+
"docker",
114+
"dribbble",
115+
"drone",
116+
"dropbox",
117+
"drupal",
118+
"duckduckgo",
119+
"ea",
120+
"ebay",
121+
"edge",
122+
"element",
123+
"elementaryos",
124+
"email",
125+
"epub",
126+
"espressif",
127+
"ethereum",
128+
"evernote",
129+
"facebook",
130+
"finder",
131+
"firefox",
132+
"flattr",
133+
"flickr",
134+
"flutter",
135+
"freecodecamp",
136+
"friendica",
137+
"fritz",
138+
"gandi",
139+
"gatehub",
140+
"ghost",
141+
"git",
142+
"gitea",
143+
"github",
144+
"gitlab",
145+
"glitch",
146+
"gmail",
147+
"gmail_old",
148+
"go",
149+
"gogcom",
150+
"gojek",
151+
"goodreads",
152+
"google",
153+
"google_calendar",
154+
"google_collaborative_content_tools",
155+
"google_docs_editors",
156+
"google_drive",
157+
"google_drive_old",
158+
"google_maps",
159+
"google_maps_old",
160+
"google_meet",
161+
"google_play",
162+
"google_plus",
163+
"google_podcasts",
164+
"google_scholar",
165+
"gradle",
166+
"grafana",
167+
"hackernews",
168+
"hackerone",
169+
"haml",
170+
"heroku",
171+
"homekit",
172+
"hp",
173+
"html5",
174+
"humblebundle",
175+
"ibm",
176+
"iheartradio",
177+
"imdb",
178+
"imgur",
179+
"instagram",
180+
"intel",
181+
"internet_archive",
182+
"itch_io",
183+
"itunes_podcasts",
184+
"java",
185+
"javascript",
186+
"jellyfin",
187+
"json",
188+
"julia",
189+
"kaggle",
190+
"keepassdx",
191+
"kemal",
192+
"keskonfai",
193+
"keybase",
194+
"kickstarter",
195+
"ko-fi",
196+
"kodi",
197+
"kotlin",
198+
"laravel",
199+
"lastpass",
200+
"liberapay",
201+
"line",
202+
"linkedin",
203+
"linux",
204+
"linux_mint",
205+
"lock",
206+
"luckyframework",
207+
"macos",
208+
"mail",
209+
"mailchimp",
210+
"markdown",
211+
"mastodon",
212+
"mattermost",
213+
"medium",
214+
"meetup",
215+
"messenger",
216+
"microformats",
217+
"microsoft",
218+
"minecraft",
219+
"nextcloud",
220+
"nhs",
221+
"npm",
222+
"ok",
223+
"openbenches",
224+
"openbugbounty",
225+
"opencast",
226+
"opencollective",
227+
"opencores",
228+
"opensource",
229+
"openvpn",
230+
"opera",
231+
"orcid",
232+
"overcast",
233+
"patreon",
234+
"paypal",
235+
"pdf",
236+
"phone",
237+
"php",
238+
"pinboard",
239+
"pinterest",
240+
"pixelfed",
241+
"plex",
242+
"pocket",
243+
"pocketcasts",
244+
"preact",
245+
"print",
246+
"protonmail",
247+
"python",
248+
"qq",
249+
"raspberry_pi",
250+
"react",
251+
"reddit",
252+
"redhat",
253+
"researchgate",
254+
"roundcube",
255+
"rss",
256+
"ruby",
257+
"rubygems",
258+
"rubyonrails",
259+
"rust",
260+
"safari",
261+
"samsung",
262+
"samsung_internet",
263+
"samsung_s",
264+
"samsung_swoop",
265+
"sass",
266+
"semaphoreci",
267+
"sentry",
268+
"signal",
269+
"sketch",
270+
"skype",
271+
"slack",
272+
"slideshare",
273+
"snapchat",
274+
"soundcloud",
275+
"spotify",
276+
"square_cash",
277+
"stackexchange",
278+
"stackoverflow",
279+
"steam",
280+
"stitcher",
281+
"strava",
282+
"stumbleupon",
283+
"svelte",
284+
"svg",
285+
"svgo.yml",
286+
"symantec",
287+
"taiga",
288+
"teamspeak",
289+
"telegram",
290+
"threema",
291+
"tiktok",
292+
"tox",
293+
"trello",
294+
"tripadvisor",
295+
"tumblr",
296+
"tunein",
297+
"tutanota",
298+
"twilio",
299+
"twitch",
300+
"twitter",
301+
"uber",
302+
"ubiquiti",
303+
"ubisoft",
304+
"ubuntu",
305+
"unicode",
306+
"untappd",
307+
"uphold",
308+
"uplay",
309+
"upwork",
310+
"vegetarian",
311+
"venmo",
312+
"viber",
313+
"vimeo",
314+
"vivino",
315+
"vk",
316+
"vlc",
317+
"vue",
318+
"w3c",
319+
"wechat",
320+
"wekan",
321+
"whatsapp",
322+
"wifi",
323+
"wikipedia",
324+
"windows",
325+
"wire",
326+
"wireguard",
327+
"wordpress",
328+
"workato",
329+
"xing",
330+
"xmpp",
331+
"yahoo",
332+
"yammer",
333+
"yarn",
334+
"yelp",
335+
"youtube",
336+
"yubico",
337+
"zoom"
338+
]
339+
|> MapSet.new()
340+
60341
@aliases %{
61342
"redirect" => ["301", "302"],
62343
"invalid" => ["412", "422"],
@@ -66,7 +347,8 @@ defmodule ComponentsGuide.Research.Static do
66347
def search_for(query) when is_binary(query) do
67348
[
68349
search_for(:http_status, query),
69-
search_for(:rfc, query)
350+
search_for(:rfc, query),
351+
search_for(:super_tiny_icon, query)
70352
]
71353
|> List.flatten()
72354
end
@@ -100,4 +382,19 @@ defmodule ComponentsGuide.Research.Static do
100382
|> Stream.filter(matches?)
101383
|> Enum.map(fn item -> {:rfc, item} end)
102384
end
385+
386+
defp search_for(:super_tiny_icon, query) when is_binary(query) do
387+
query = query |> String.downcase() |> String.trim()
388+
389+
case MapSet.member?(@icon_names, query) do
390+
true ->
391+
[
392+
{:super_tiny_icon,
393+
%{name: query, url: "https://unpkg.com/[email protected]/images/svg/#{query}.svg"}}
394+
]
395+
396+
false ->
397+
[]
398+
end
399+
end
103400
end

apps/components_guide_web/lib/components_guide_web/controllers/research_controller.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ defmodule ComponentsGuideWeb.ResearchView do
364364
])
365365
end
366366

367+
def render(:super_tiny_icon, %{name: name, url: url}) do
368+
Section.card([
369+
content_tag(:h3, "#{name |> String.capitalize()} Icon", class: "text-2xl font-bold"),
370+
link(url, to: url, class: "text-base"),
371+
tag(:img, src: url, width: 80, height: 80)
372+
])
373+
end
374+
367375
def link_to_spec("rfc" <> _ = spec) do
368376
link(spec, to: "https://tools.ietf.org/html/" <> spec)
369377
end

0 commit comments

Comments
 (0)