Skip to content

Currents state of staging #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 170 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
1a95367
feat(): Introduce styleguide page
jedrzejchalubek Sep 26, 2019
084eaa1
feat(): Introduce base typography and fonts
jedrzejchalubek Sep 26, 2019
6ae2cd9
feat(): Prepare colors palette (#67)
bart-krakowski Sep 26, 2019
e788ffd
feat(): Introduce image object (#70)
bart-krakowski Sep 26, 2019
12e3a75
fix(styleguide): Use page layout directly as styleguide template
jedrzejchalubek Sep 26, 2019
ca47b7b
feat(): Introduce anchor component (#73)
bart-krakowski Sep 26, 2019
00edc14
refactor(): Rename gray colors so we can have more names in a future
jedrzejchalubek Sep 26, 2019
4a55cdb
feat(): Introduce headings (#68)
bart-krakowski Sep 26, 2019
248c532
feat(): Introduce unordered list (#72)
bart-krakowski Sep 26, 2019
44fea79
fix(): Add breakpoints sizes map variable
jedrzejchalubek Sep 26, 2019
4d18270
feat(): Introduce ordered list (#71)
bart-krakowski Sep 26, 2019
019c056
Merge branch 'master' into develop
jedrzejchalubek Sep 27, 2019
178931a
refactor(variables): Use color form colors map for text
jedrzejchalubek Sep 27, 2019
5a5e14e
feat(): Introduce flex, gutter and waffle components
jedrzejchalubek Sep 27, 2019
b816477
fix(): Script tags should be before closing body tag
jedrzejchalubek Sep 27, 2019
7109ae1
refactor(flex): Use 24col based grid
jedrzejchalubek Sep 27, 2019
c14f896
feat(): Introduce button link (#76)
imklau Sep 27, 2019
bfc8a98
Revert "refactor(flex): Use 24col based grid"
jedrzejchalubek Sep 27, 2019
e1b3a9d
wip(): Working on default layout structure
jedrzejchalubek Sep 27, 2019
b0473ec
feat(): Introduce Note component (#77)
imklau Sep 27, 2019
593ef99
feat(): Introduce alert component (#75)
bart-krakowski Sep 30, 2019
44876bf
refactor(): Refactor in stage and docs components
jedrzejchalubek Sep 30, 2019
7439c2d
11 table (#74)
bart-krakowski Sep 30, 2019
1b4aba5
wip(): WOrking on general layouts
jedrzejchalubek Oct 1, 2019
18cca9a
feat(): Introduce media icon (#78)
bart-krakowski Oct 1, 2019
9c34baf
feat(): Introduce list steps (#80)
bart-krakowski Oct 1, 2019
009202c
feat(): Introduce refactored table (#79)
bart-krakowski Oct 1, 2019
eb54c05
refactor(): Remove redundant data attr
jedrzejchalubek Oct 1, 2019
91df25d
feat(): Introduce field and input components
jedrzejchalubek Oct 1, 2019
00a4512
Merge branch '13-input-field' into develop
jedrzejchalubek Oct 1, 2019
023e9f7
fix(): Adjust width of general 3 column layout
jedrzejchalubek Oct 1, 2019
acf77e8
wip(): Navbar spacings
jedrzejchalubek Oct 1, 2019
d37194d
refactor(): Move stylized elements to markdown scope so it wont affec…
jedrzejchalubek Oct 1, 2019
acef5b4
wip(): Working on page content
jedrzejchalubek Oct 1, 2019
c2d07ed
feat(): Buttons (#81)
bart-krakowski Oct 1, 2019
846dc8d
fix(nav): Justify buttons in navbar
jedrzejchalubek Oct 1, 2019
8ca57ef
feat(): Introduce code, pre and its highlighting
jedrzejchalubek Oct 1, 2019
e0443a7
fix(navbar): Enable searching of swiftsearch
jedrzejchalubek Oct 1, 2019
5fd61f8
Update README.md
Sep 23, 2019
ca60df0
squash commits
Oct 1, 2019
a92f2a1
remove chmod command
Oct 1, 2019
b0cb3c8
resolve conflict
Oct 1, 2019
864fd7b
resolve conflict
Oct 1, 2019
f82d3cd
update permissions of build process"
Oct 1, 2019
58759e3
clean up build process
Oct 1, 2019
abdd9f3
test changes
Oct 1, 2019
5ea85b0
feat(): breadcrumbs (#82)
bart-krakowski Oct 2, 2019
c06d423
fix(): Move icons to the includes directory (#84)
imklau Oct 2, 2019
581b1ab
feat(): Side menu and sidebar
jedrzejchalubek Oct 2, 2019
c708181
feat(): Introduce Footer (#88)
imklau Oct 2, 2019
eb642c8
feat(): Introduce Thumbnail Integration component; Create Destination…
imklau Oct 2, 2019
9983cbf
feat(): Introduce new styles for search (#86)
bart-krakowski Oct 2, 2019
82647dc
fix(markdown): Limit width of images
jedrzejchalubek Oct 2, 2019
25c4018
feat(): Panel component (#85)
bart-krakowski Oct 2, 2019
8050834
feat(): Callout (#87)
bart-krakowski Oct 3, 2019
e97018b
wip(): Introduce accordion module and menu structure
jedrzejchalubek Oct 3, 2019
3cc107e
fix(config): Remove rendering limiting to specified pages
jedrzejchalubek Oct 3, 2019
6973f7f
fix trailing slashes in links, and delete CI
Oct 3, 2019
c5c2372
resolve conflict
Oct 3, 2019
d528969
feat(): Introduce new footer for mobile devices (#91)
imklau Oct 4, 2019
ee68aed
Fix list steps styling (#94)
imklau Oct 4, 2019
1fd147d
refactor(): Use flex for creating alert layout (#93)
imklau Oct 4, 2019
52f9902
feat(): Introduce new search navbar for mobile devices (#90)
imklau Oct 4, 2019
ec108d6
feat(): Menu (#95)
jedrzejchalubek Oct 4, 2019
22c64bb
Merge branch 'staging' into develop
jedrzejchalubek Oct 4, 2019
d0aa9ee
Merge branch 'develop' into staging
jedrzejchalubek Oct 4, 2019
0e0bee9
fix(): Spacing in nested menu items
jedrzejchalubek Oct 4, 2019
809c61b
fix(): Markdown output fixes
jedrzejchalubek Oct 4, 2019
f6dab89
fix(): Bring back autogenerated data files
jedrzejchalubek Oct 4, 2019
39e4170
Homepage (#97)
imklau Oct 7, 2019
38d1ca1
feat(): Add rest of items to menu
jedrzejchalubek Oct 7, 2019
11602d2
fix(): Max-width set for desktop viewport
Oct 7, 2019
695edf8
feat(): Add rest of items to menu
Oct 7, 2019
aa45b89
fix(): Replace href links in landing section (#98)
imklau Oct 7, 2019
1780f95
feat(): Introduce close icon (#99)
imklau Oct 7, 2019
4d4e180
Feat menu active (#100)
jedrzejchalubek Oct 7, 2019
c116984
fix(breadcumbs): Hide overflow
jedrzejchalubek Oct 7, 2019
3041034
fix(menu-item): Color of a link
jedrzejchalubek Oct 7, 2019
cf39e0f
fix(menu-item): Links should have pointer cursor
jedrzejchalubek Oct 7, 2019
dcc4d1d
fix(menu-side): Font size of links
jedrzejchalubek Oct 7, 2019
e25a5c1
refactor(media-icon): Extract small variant to new media-thumbnail co…
jedrzejchalubek Oct 7, 2019
e1994cc
fix(): Fix config
jedrzejchalubek Oct 7, 2019
6deecba
fix(): Feedback box font sizes changes; Content alignment
Oct 7, 2019
caefd44
Resolve merge conflicts
Oct 7, 2019
7d1a20d
fix(): Social list svg color
Oct 7, 2019
e66e38d
refactor(media-thumbnail): Hover state and fill of icons
jedrzejchalubek Oct 7, 2019
cd1aae9
fix(): Heading space on mobile viewport
Oct 7, 2019
cd347f6
fix(): Space between copy
Oct 7, 2019
6c9a1e8
fix(meda-thumbnail): Mobile padding
jedrzejchalubek Oct 7, 2019
36ab122
fix(): Remove unnecessary params in feedback include
Oct 8, 2019
d4fab23
fix(): Remove unnecessary params from the callout
Oct 8, 2019
ac81411
fix(): Too large spacing inside the feedback boxes; Add border to the…
Oct 8, 2019
2e3f3b6
fix(): Set a different breakpoint for media thumbnail component
Oct 8, 2019
b845470
refactor(): Clean up unused files
jedrzejchalubek Oct 8, 2019
777de77
feat(): Introduce mobile panel for Home (#101)
imklau Oct 8, 2019
6f71329
fix(): Thumbnail border color
Oct 8, 2019
fada6c0
fix(): Wrong bg color, paddings and inset shadow
Oct 8, 2019
136b270
feat(): Introduce destinations catalog (#102)
bart-krakowski Oct 8, 2019
41780bf
fix(): Sticky sidebar top space
Oct 9, 2019
eefc83d
fix(): Apply styles for search results in dropdown, not the modal
Oct 9, 2019
9217afd
feat(): Introduce navbar mobile (#103)
jedrzejchalubek Oct 9, 2019
578f05c
feat(markdown): Add responsive spaces for markdown elements
jedrzejchalubek Oct 9, 2019
386f080
fix(logo): Add slash to home link
jedrzejchalubek Oct 9, 2019
7478209
fix(markdown): Internal spacing in table
jedrzejchalubek Oct 9, 2019
e2fb84e
feat(): Introduce Avatar component (#105)
imklau Oct 10, 2019
a6334b1
feat(): Introduce accordion component (#106)
bart-krakowski Oct 10, 2019
5b4ca93
fix(layout): Include navbar-mobile partial in destination layout
jedrzejchalubek Oct 10, 2019
8e94e96
fix(): Add missing links to CTA Banner component (#110)
bart-krakowski Oct 10, 2019
8cf7331
feat(): Add link to consent manage (#111)
bart-krakowski Oct 10, 2019
d1b89cc
fix(): Suport for mobile Safari, add anchor indicator, centering icon…
bart-krakowski Oct 10, 2019
3709d93
fix(): restriction of box height (#109)
bart-krakowski Oct 10, 2019
8624014
fix(): Change color of heading and fix spaces (#114)
bart-krakowski Oct 11, 2019
0c3f390
fix(faq): Add missing link (#115)
bart-krakowski Oct 11, 2019
284ef9e
feat(): Introduce new design for feedback widget (#113)
bart-krakowski Oct 11, 2019
a6f677d
feat(): Introduce example of Single Page (#116)
imklau Oct 11, 2019
e7e9be9
fix(): Heading overlapping (#117)
imklau Oct 11, 2019
c0395c9
refactor(): Remove duplicated consent manager script
jedrzejchalubek Oct 11, 2019
45a1a99
feat(): Introduce 404 page (#118)
bart-krakowski Oct 11, 2019
77506d3
fix(): FAQ read more link (#120)
imklau Oct 14, 2019
6867c1f
feat(): Introduce the article page (#119)
imklau Oct 14, 2019
29712f3
fix(alert): Place flex inside the component to prevent background sti…
Oct 14, 2019
a9ff152
fix(note): Add spacing inside the content
Oct 14, 2019
f408e0e
fix(menu-side): Add active state
Oct 14, 2019
a61ce07
fix(): Change page structure; Add new anchors to related items & faq
Oct 14, 2019
126147f
fix(): Add missing links to the faq items
Oct 14, 2019
373ffb5
feat(): Introduce code example component
jedrzejchalubek Oct 14, 2019
652b84e
fix(menu-item): Add missing back button
Oct 15, 2019
660b5aa
feat(): Introduce new Graphik font
Oct 15, 2019
abe2de6
fix(): Font weights
Oct 15, 2019
4b201c0
fix(list-steps): Align the number
Oct 15, 2019
87a9891
feat() Introduce single integration page (#121)
bart-krakowski Oct 15, 2019
080fc73
fix(): Change background to gray (#122)
bart-krakowski Oct 15, 2019
cbe6845
fix(): Change position of icon (#124)
bart-krakowski Oct 16, 2019
4a3f69f
fix(): Add space in callout component (#125)
bart-krakowski Oct 16, 2019
cd363cd
fix(): Make clicable headings (#123)
bart-krakowski Oct 16, 2019
6bf64c7
fix(list-steps): Align steps icons
Oct 16, 2019
47f8b3e
fix(note): Align note icon
Oct 16, 2019
9a2d374
feat(): Introudce popover (#128)
imklau Oct 16, 2019
422e9d3
feat(): Introduce catalog layout for warehouses catalog page (#127)
bart-krakowski Oct 16, 2019
4d8acd9
fix(menu-item): Allow fot 3rd nested menu
jedrzejchalubek Oct 16, 2019
6286033
feat(): Introduce search bar for 404 page (#129)
imklau Oct 16, 2019
f594c10
fix(warehauses): Proper links to single warehouse integration on cata…
jedrzejchalubek Oct 17, 2019
843077d
fix(menu-item): Introduce a new active color for nested menu items (#…
imklau Oct 17, 2019
f7fa4e2
fix(): Add pointer cursor for headings (#132)
bart-krakowski Oct 17, 2019
3d2a67f
feat(): Introduce missing mobile nav based on desktop sidebar (#133)
imklau Oct 17, 2019
5efa9ea
fix(): Remove link to nonexistent file (#134)
bart-krakowski Oct 17, 2019
767ccce
fix(home): Missing spacing between the heading and the paragraph
Oct 17, 2019
cd3f00c
feat(breadcrumbs): Introduce new effect for mobile breadcrumbs (#138)
imklau Oct 17, 2019
9120714
fix(): Change styles for note (#135)
bart-krakowski Oct 17, 2019
1917db2
fix(): Add author and callout panel (#136)
bart-krakowski Oct 17, 2019
121ff9c
fix(): Missing mobile nav for integration page (#137)
imklau Oct 17, 2019
4c7aee2
fix(popover): Set new z-index
Oct 18, 2019
d5c10f8
fix(): Change line-eight of heading, align symbol to right (#140)
bart-krakowski Oct 18, 2019
8f3a80b
chore(): Merge changes from master
jedrzejchalubek Oct 21, 2019
2f95f53
fix(): Fix detection of the active section (#142)
bart-krakowski Oct 21, 2019
f3f8416
feat(): Introduce catalog layout for sources catalog page (#126)
bart-krakowski Oct 21, 2019
83cffa3
fix(landing): Links for the pages media thubnails
jedrzejchalubek Oct 23, 2019
e90159f
feat(): Introduce new approach to displaying ordinal numbers in dates
Oct 23, 2019
ab4dbed
Merge branch 'staging' of github.com:segmentio/segment-docs into staging
Oct 23, 2019
be59747
feat(): Introduce back to top button (#143)
imklau Oct 23, 2019
a19b212
refactor(): New js scripts to replace rakefile (#112)
jknight12882 Oct 24, 2019
8b4df82
fix(data): Bring back proper catalog yaml files
jedrzejchalubek Oct 24, 2019
b160947
fix(data): Bring back old data files
jedrzejchalubek Oct 24, 2019
1b78b7c
refactor(destinations): Introduce another loop based on new data file…
imklau Oct 24, 2019
27b797e
feat(menu): Introduce destination and sources catalog menus
jedrzejchalubek Oct 24, 2019
be79cba
fix(integration): Links in menu
jedrzejchalubek Oct 24, 2019
9f9c047
fix(): urls
Oct 24, 2019
878255b
Merge branch 'master' into staging
jedrzejchalubek Oct 25, 2019
b76869c
feat(): Mobile menu panels (#139)
jedrzejchalubek Oct 25, 2019
0323b73
refactor(sources): Introduce another loop based on new data files (#147)
bart-krakowski Oct 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ docker-build:
@$(DOCKER_TTY) make build
bundle install


#.PHONY: docs
#docs: node_modules
# $(BIN)/webpack --mode=production
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ You will need to have Docker installed https://docs.docker.com/install/

* If using Linux, run `docker-compose up`

* Visit http://localhost:4000/docsv2/

# Local development with `ruby` and `node`, without platform-api

* If using OSX, install command line tools, `xcode-select --install`
Expand Down
9 changes: 8 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ baseurl: "/docsv2" # the subpath of your site, e.g. /blog
url: "http://0.0.0.0:4000" # the base hostname & protocol for your site, e.g. http://example.com
source: ./src

permalink: /:categories/:title/

# Build settings
markdown: kramdown
highlighter: rouge
Expand All @@ -20,12 +22,17 @@ defaults:
path: "connections/destinations"
values:
integration_type: destination
layout: integration
- scope:
path: "connections/sources/catalog"
values:
integration_type: source
- scope:
path: "connections/warehouses/catalog"
values:
integration_type: warehouse

permalink: /:categories/:title/
plugins_dir: ./_plugins
plugins:
- jekyll-sitemap
- jekyll-redirect-from
Expand Down
54 changes: 54 additions & 0 deletions _plugins/jekyll-code-example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require "erb"

module Jekyll
module CodeExample
class CodeExample < Liquid::Block
def render(context)
environment = context.environments.first
environment['codeexample'] = {} # reset each time
super
template = ERB.new <<-EOF
<div class="code-example" data-code-example>
<div class="code-example__nav flex" data-ref="code-example[nav]">
<% environment['codeexample'].each_with_index do |(key, _), index| %>
<div class="code-example__nav-item flex__column flex__column--shrink" data-class-active="code-example__nav-item--active">
<a href="#" class="code-example__nav-link"><%= key %></a>
</div>
<% end %>
</div>

<div class="code-example__body" data-ref="code-example[body]">
<% environment['codeexample'].each do |_, value| %>
<div class="code-example__tab" data-class-active="code-example__tab--active"><%= value %></div>
<% end %>
</div>
</div>
EOF
template.result(binding)
end
end

class CodeExampleTab < Liquid::Block
alias_method :render_block, :render

def initialize(tag_name, markup, tokens)
super
if markup == ""
raise SyntaxError.new("No toggle name given in #{tag_name} tag")
end
@toggle = markup.strip
end

def render(context)
site = context.registers[:site]
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
environment = context.environments.first
environment['codeexample'] ||= {}
environment['codeexample'][@toggle] = converter.convert(render_block(context))
end
end
end
end

Liquid::Template.register_tag("codeexampletab", Jekyll::CodeExample::CodeExampleTab)
Liquid::Template.register_tag("codeexample", Jekyll::CodeExample::CodeExample)
74 changes: 74 additions & 0 deletions _plugins/jekyll-humanize.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module Jekyll

module Humanize
##
# This is a port of the Django app `humanize` which adds a "human touch"
# to data. Given that Jekyll produces static sites, some of the original
# methods do not make logical sense (e.g. naturaltime).
#
# Source code can be viewed here:
# https://github.com/django/django
#
# Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.

####################
# PUBLIC METHODS #
####################

def ordinal(value, flag=nil)
##
# Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd',
# 3 is '3rd', etc. Works for any integer.
#
# Usage:
# {{ somenum }} >>> 3
# {{ somenum | ordinal }} >>> '3rd'
# {{ somenum | ordinal: "super" }} >>> '3<sup>rd</sup>'

begin
value = value.to_i
flag.to_s.downcase!
rescue Exception => e
puts "#{e.class} #{e}"
return value
end

suffix = ""
suffixes = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"]
unless [11, 12, 13].include? value % 100 then
suffix = suffixes[value % 10]
else
suffix = suffixes[0]
end

unless flag and flag == "super"
return "#{value}%s" % suffix
else
return "#{value}<sup>%s</sup>" % suffix
end

end

#####################
# PRIVATE METHODS #
#####################

private
def time(input)
case input
when Time
input
when String
Time.parse(input)
else
Jekyll.logger.error "Invalid Date:", "'#{input}' not valid datetime."
exit(1)
end
end

end

end

Liquid::Template.register_filter(Jekyll::Humanize)
23 changes: 23 additions & 0 deletions js/accordion-group/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const COMPONENT_NAME = 'data-accordion-group'
const COMPONENT_SELECTOR = `[${COMPONENT_NAME}]`
const ACCORDION_SELECTOR = `[data-accordion]`

export default function () {
const components = document.querySelectorAll(COMPONENT_SELECTOR)

components.forEach(component => {
const accordions = component.querySelectorAll(ACCORDION_SELECTOR)

accordions.forEach(currentAccordion => {
currentAccordion.addEventListener('accordion.triggered', () => {
accordions.forEach(accordion => {
let activeClass = accordion.getAttribute('data-class-active') || 'active'

if (accordion.classList.contains(activeClass) && accordion != currentAccordion) {
accordion.classList.remove(activeClass)
}
})
})
})
})
}
29 changes: 29 additions & 0 deletions js/accordion/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Creates a custom DOM event.
*
* @param {String} name
* @return {Event}
*/
function createEvent (name) {
const event = document.createEvent('Event')

event.initEvent(name, true, true)

return event
}

/**
* First visit
*
* Example:
* el.addEventListener('cookies.firstVisit', () => { ... })
*
* @type {Event}
*/
const accordionTriggered = createEvent('accordion.triggered')



export {
accordionTriggered
}
28 changes: 28 additions & 0 deletions js/accordion/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { accordionTriggered } from './events'

const COMPONENT_NAME = 'data-accordion'
const COMPONENT_SELECTOR = `[${COMPONENT_NAME}]`
const TRIGGER_SELECTOR = `[data-ref="accordion[trigger]"]`
const BODY_SELECTOR = `[data-ref="accordion[body]"]`

export default function () {
const components = document.querySelectorAll(COMPONENT_SELECTOR)

for (let i = 0; i < components.length; i++) {
let body = components[i].querySelector(BODY_SELECTOR)
let trigger = components[i].querySelector(TRIGGER_SELECTOR)

if (body) {
let activeClass = components[i].getAttribute('data-class-active') || 'active'

if (trigger) {
trigger.addEventListener('click', (event) => {
event.preventDefault()

components[i].dispatchEvent(accordionTriggered)
components[i].classList.toggle(activeClass)
})
}
}
}
}
49 changes: 49 additions & 0 deletions js/anchors-indicator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

const COMPONENT_SELECTOR = '[data-anchors-indicator]'
const ACTIVE_CLASS = 'data-active-class'
const SECTION_ATTR= 'data-sections'
const options = {
rootMargin: 50
}

const throttle = (fn, wait) => {
var time = Date.now();
return function() {
if ((time + wait - Date.now()) < 0) {
fn();
time = Date.now();
}
}
}

export default () => {
const components = document.querySelectorAll(COMPONENT_SELECTOR)

components.forEach(component => {
const sectionSelector = component.getAttribute(SECTION_ATTR)
const activeClass = component.getAttribute(ACTIVE_CLASS)
const sections = document.querySelectorAll(`${sectionSelector}`)
const allLinks = component.querySelectorAll("a");

function scrollspy() {
sections.forEach(current => {
let currentElementOffset = current.offsetTop;
let scrollPosition =
document.documentElement.scrollTop || document.body.scrollTop;
if (currentElementOffset <= scrollPosition + options.rootMargin) {
allLinks.forEach(currentLink => {
currentLink.classList.remove(activeClass);
});
const currentID = current.getAttribute("id");

if ( currentID ) {
component
.querySelector(`a[href="#${currentID}"]`)
.classList.add(activeClass);
}
}
});
}
window.addEventListener("scroll", throttle(scrollspy, 200))
})
}
21 changes: 21 additions & 0 deletions js/back-scrolling/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const COMPONENT_SELECTOR = '[data-back-scrolling]'

export default function () {
const components = document.querySelectorAll(COMPONENT_SELECTOR)

for (let i = 0; i < components.length; i++) {
window.onscroll = () => {
if (document.body.scrollTop > 30 || document.documentElement.scrollTop > 30) {
components[i].classList.add(components[i].dataset.activeClass)
} else {
components[i].classList.remove(components[i].dataset.activeClass)
}
}

components[i].addEventListener('click', e => {
e.preventDefault()

window.scrollTo({top: 0, behavior: 'smooth'})
})
}
}
35 changes: 35 additions & 0 deletions js/code-example/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const COMPONENT_SELECTOR = '[data-code-example]'
const NAV_SELECTOR = '[data-ref*="code-example[nav]"]'
const BODY_SELECTOR = '[data-ref*="code-example[body]"]'

export default function () {
const components = document.querySelectorAll(COMPONENT_SELECTOR)

for (let i = 0; i < components.length; i++) {
const tabs = components[i].querySelector(BODY_SELECTOR).children
const triggers = components[i].querySelector(NAV_SELECTOR).children

tabs[0].classList.add(tabs[0].getAttribute('data-class-active'))
triggers[0].classList.add(triggers[0].getAttribute('data-class-active'))

for (let i = 0; i < triggers.length; i++) {
triggers[i].addEventListener('click', (event) => {
event.preventDefault()

let tabActiveClass = tabs[i].getAttribute('data-class-active')
let triggerActiveClass = triggers[i].getAttribute('data-class-active')

for (let t = 0; t < triggers.length; t++) {
triggers[t].classList.remove(triggerActiveClass)
}

for (let t = 0; t < tabs.length; t++) {
tabs[t].classList.remove(tabActiveClass)
}

tabs[i].classList.add(tabActiveClass)
triggers[i].classList.add(triggerActiveClass)
})
}
}
}
Loading